mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Sort videoIds before performing DeArrow fetch.
This commit is contained in:
parent
3c5ef9524f
commit
e6e70a597d
@ -32,7 +32,11 @@ object DeArrowUtil {
|
|||||||
suspend fun deArrowStreamItems(streamItems: List<StreamItem>): List<StreamItem> {
|
suspend fun deArrowStreamItems(streamItems: List<StreamItem>): List<StreamItem> {
|
||||||
if (!PreferenceHelper.getBoolean(PreferenceKeys.DEARROW, false)) return streamItems
|
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 {
|
val response = try {
|
||||||
RetrofitInstance.api.getDeArrowContent(videoIds)
|
RetrofitInstance.api.getDeArrowContent(videoIds)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@ -55,7 +59,11 @@ object DeArrowUtil {
|
|||||||
if (!PreferenceHelper.getBoolean(PreferenceKeys.DEARROW, false)) return contentItems
|
if (!PreferenceHelper.getBoolean(PreferenceKeys.DEARROW, false)) return contentItems
|
||||||
|
|
||||||
val videoIds = contentItems.filter { it.type == "stream" }
|
val videoIds = contentItems.filter { it.type == "stream" }
|
||||||
.joinToString(",") { it.url.toID() }
|
.map { it.url.toID() }
|
||||||
|
.sorted()
|
||||||
|
.toSet()
|
||||||
|
.joinToString(",")
|
||||||
|
|
||||||
if (videoIds.isEmpty()) return contentItems
|
if (videoIds.isEmpty()) return contentItems
|
||||||
|
|
||||||
val response = try {
|
val response = try {
|
||||||
|
Loading…
Reference in New Issue
Block a user