forked from recloudstream/cloudstream
[Feature] Use subtitle filename, instead of movie title for Opensubtitles search. (#223)
* [Feature] Use subtitle filename, instead of movie title for Opensubtitles search. * Optimize iteration for first not null value
This commit is contained in:
parent
eb90b79bf9
commit
42d1dd9f7d
1 changed files with 6 additions and 2 deletions
|
@ -200,8 +200,12 @@ class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi
|
|||
it.data?.forEach { item ->
|
||||
val attr = item.attributes ?: return@forEach
|
||||
val featureDetails = attr.featDetails
|
||||
//Use filename as name, if its valid
|
||||
val filename = attr.files?.firstNotNullOfOrNull { subfile ->
|
||||
subfile.fileName
|
||||
}
|
||||
//Use any valid name/title in hierarchy
|
||||
val name = featureDetails?.movieName ?: featureDetails?.title
|
||||
val name = filename ?: featureDetails?.movieName ?: featureDetails?.title
|
||||
?: featureDetails?.parentTitle ?: attr.release ?: ""
|
||||
val lang = fixLanguageReverse(attr.language)?: ""
|
||||
val resEpNum = featureDetails?.episodeNumber ?: query.epNumber
|
||||
|
@ -330,4 +334,4 @@ class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi
|
|||
@JsonProperty("parent_tmdb_id") var parentTmdbId: Int? = null,
|
||||
@JsonProperty("parent_feature_id") var parentFeatureId: Int? = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue