mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Merge pull request #4290 from FireMasterK/dearrow-sort
Sort videoIds before performing DeArrow fetch
This commit is contained in:
commit
1d554b9809
@ -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