mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
removed possible duplicate download queue
This commit is contained in:
parent
3ea6b1a8d5
commit
d436171a2f
1 changed files with 4 additions and 5 deletions
|
@ -1598,9 +1598,8 @@ object VideoDownloadManager {
|
|||
val item = pkg.item
|
||||
val id = item.ep.id
|
||||
if (currentDownloads.contains(id)) { // IF IT IS ALREADY DOWNLOADING, RESUME IT
|
||||
downloadEvent.invoke(Pair(id, DownloadActionType.Resume))
|
||||
/** ID needs to be returned to the work-manager to properly await notification */
|
||||
// return id
|
||||
downloadEvent.invoke(id to DownloadActionType.Resume)
|
||||
return
|
||||
}
|
||||
|
||||
currentDownloads.add(id)
|
||||
|
@ -1741,14 +1740,14 @@ object VideoDownloadManager {
|
|||
notificationCallback: (Int, Notification) -> Unit,
|
||||
setKey: Boolean = true
|
||||
) {
|
||||
if (!currentDownloads.any { it == pkg.item.ep.id }) {
|
||||
if (!currentDownloads.any { it == pkg.item.ep.id } && !downloadQueue.any { it.item.ep.id == pkg.item.ep.id }) {
|
||||
downloadQueue.addLast(pkg)
|
||||
downloadCheck(context, notificationCallback)
|
||||
if (setKey) saveQueue()
|
||||
//ret
|
||||
} else {
|
||||
downloadEvent(
|
||||
Pair(pkg.item.ep.id, DownloadActionType.Resume)
|
||||
pkg.item.ep.id to DownloadActionType.Resume
|
||||
)
|
||||
//null
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue