mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
[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 ->
|
it.data?.forEach { item ->
|
||||||
val attr = item.attributes ?: return@forEach
|
val attr = item.attributes ?: return@forEach
|
||||||
val featureDetails = attr.featDetails
|
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
|
//Use any valid name/title in hierarchy
|
||||||
val name = featureDetails?.movieName ?: featureDetails?.title
|
val name = filename ?: featureDetails?.movieName ?: featureDetails?.title
|
||||||
?: featureDetails?.parentTitle ?: attr.release ?: ""
|
?: featureDetails?.parentTitle ?: attr.release ?: ""
|
||||||
val lang = fixLanguageReverse(attr.language)?: ""
|
val lang = fixLanguageReverse(attr.language)?: ""
|
||||||
val resEpNum = featureDetails?.episodeNumber ?: query.epNumber
|
val resEpNum = featureDetails?.episodeNumber ?: query.epNumber
|
||||||
|
|
Loading…
Reference in a new issue