mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Optimize iteration for first not null value
This commit is contained in:
parent
219fd5a461
commit
4bfccb717c
1 changed files with 4 additions and 4 deletions
|
@ -201,9 +201,9 @@ class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi
|
|||
val attr = item.attributes ?: return@forEach
|
||||
val featureDetails = attr.featDetails
|
||||
//Use filename as name, if its valid
|
||||
val filename = attr.files?.mapNotNull { subfile ->
|
||||
subfile.fileName ?: return@mapNotNull null
|
||||
}?.firstOrNull()
|
||||
val filename = attr.files?.firstNotNullOfOrNull { subfile ->
|
||||
subfile.fileName
|
||||
}
|
||||
//Use any valid name/title in hierarchy
|
||||
val name = filename ?: featureDetails?.movieName ?: featureDetails?.title
|
||||
?: featureDetails?.parentTitle ?: attr.release ?: ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue