mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-09 13:54:36 -05:00
Downloader Rewrite (#437)
* Downloader rewrite - Rewrite downloader to use coroutines instead of a thread - Remove unused Page functions - Add page progress - Add ProgressResponseBody - Add support for canceling a download in the middle of downloading - Fix clear download queue * Minor fix * Minor improvements - notifyAllClients now launches in another thread and only sends new data every second - Better handling of download queue checker in step() - Minor improvements and fixes * Reorder downloads * Download in parallel by source * Remove TODO
This commit is contained in:
@@ -46,10 +46,8 @@ object DownloadController {
|
||||
description("Start the downloader")
|
||||
}
|
||||
},
|
||||
behaviorOf = { ctx ->
|
||||
behaviorOf = {
|
||||
DownloadManager.start()
|
||||
|
||||
ctx.status(200)
|
||||
},
|
||||
withResults = {
|
||||
httpCode(HttpCode.OK)
|
||||
@@ -65,9 +63,9 @@ object DownloadController {
|
||||
}
|
||||
},
|
||||
behaviorOf = { ctx ->
|
||||
DownloadManager.stop()
|
||||
|
||||
ctx.status(200)
|
||||
ctx.future(
|
||||
future { DownloadManager.stop() }
|
||||
)
|
||||
},
|
||||
withResults = {
|
||||
httpCode(HttpCode.OK)
|
||||
@@ -83,9 +81,9 @@ object DownloadController {
|
||||
}
|
||||
},
|
||||
behaviorOf = { ctx ->
|
||||
DownloadManager.clear()
|
||||
|
||||
ctx.status(200)
|
||||
ctx.future(
|
||||
future { DownloadManager.clear() }
|
||||
)
|
||||
},
|
||||
withResults = {
|
||||
httpCode(HttpCode.OK)
|
||||
@@ -155,4 +153,23 @@ object DownloadController {
|
||||
httpCode(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
/** clear download queue */
|
||||
val reorderChapter = handler(
|
||||
pathParam<Int>("chapterIndex"),
|
||||
pathParam<Int>("mangaId"),
|
||||
pathParam<Int>("to"),
|
||||
documentWith = {
|
||||
withOperation {
|
||||
summary("Downloader reorder chapter")
|
||||
description("Reorder chapter in download queue")
|
||||
}
|
||||
},
|
||||
behaviorOf = { _, chapterIndex, mangaId, to ->
|
||||
DownloadManager.reorder(chapterIndex, mangaId, to)
|
||||
},
|
||||
withResults = {
|
||||
httpCode(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user