mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
fix: automatically resume next paused download item after finishing previous one
This commit is contained in:
parent
247157322f
commit
ad2539c28d
@ -227,12 +227,18 @@ class DownloadService : LifecycleService() {
|
|||||||
|
|
||||||
downloadQueue[item.id] = false
|
downloadQueue[item.id] = false
|
||||||
|
|
||||||
if (_downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
|
if (downloadFlow.firstOrNull { it.first == item.id }?.second == DownloadStatus.Stopped) {
|
||||||
downloadQueue.remove(item.id, false)
|
downloadQueue.remove(item.id, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start the next download if there are any remaining ones enqueued
|
||||||
|
val nextDownload = downloadFlow.firstOrNull { (_, status) -> status == DownloadStatus.Paused }
|
||||||
|
if (nextDownload != null) {
|
||||||
|
resume(nextDownload.first)
|
||||||
|
} else {
|
||||||
stopServiceIfDone()
|
stopServiceIfDone()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun progressDownload(
|
private suspend fun progressDownload(
|
||||||
item: DownloadItem,
|
item: DownloadItem,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user