Sort videoIds before performing DeArrow fetch.

This commit is contained in:
Kavin 2023-07-22 17:26:47 +01:00
parent 3c5ef9524f
commit e6e70a597d
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F

View File

@ -32,7 +32,11 @@ object DeArrowUtil {
suspend fun deArrowStreamItems(streamItems: List<StreamItem>): List<StreamItem> {
if (!PreferenceHelper.getBoolean(PreferenceKeys.DEARROW, false)) return streamItems
val videoIds = streamItems.mapNotNull { it.url?.toID() }.joinToString(",")
val videoIds = streamItems.mapNotNull { it.url?.toID() }
.sorted()
.toSet()
.joinToString(",")
val response = try {
RetrofitInstance.api.getDeArrowContent(videoIds)
} catch (e: Exception) {
@ -55,7 +59,11 @@ object DeArrowUtil {
if (!PreferenceHelper.getBoolean(PreferenceKeys.DEARROW, false)) return contentItems
val videoIds = contentItems.filter { it.type == "stream" }
.joinToString(",") { it.url.toID() }
.map { it.url.toID() }
.sorted()
.toSet()
.joinToString(",")
if (videoIds.isEmpty()) return contentItems
val response = try {