Merge pull request #4286 from Bnyro/master

fix: improve filtering of DeArrow titles and thumbnails
This commit is contained in:
Bnyro 2023-07-21 09:01:54 +02:00 committed by GitHub
commit 3c5ef9524f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,10 +19,10 @@ object DeArrowUtil {
} catch (e: Exception) {
return null to null
}
val newTitle = content.titles.maxByOrNull { it.votes }?.title
val newThumbnail =
content.thumbnails.filter { it.thumbnail != null }.maxByOrNull { it.votes }
?.takeIf { !it.original }?.thumbnail
val newTitle = content.titles.firstOrNull { it.votes >= 0 || it.locked }?.title
val newThumbnail = content.thumbnails.firstOrNull {
it.thumbnail != null && !it.original && (it.votes >= 0 || it.locked)
}?.thumbnail
return newTitle to newThumbnail
}