mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 06:31:47 +01:00
Start downloader after a library update. It should help with some catalogue issues
This commit is contained in:
parent
182bf5f2bd
commit
34a40b0131
@ -85,9 +85,10 @@ class DownloadManager(context: Context) {
|
|||||||
*
|
*
|
||||||
* @param manga the manga of the chapters.
|
* @param manga the manga of the chapters.
|
||||||
* @param chapters the list of chapters to enqueue.
|
* @param chapters the list of chapters to enqueue.
|
||||||
|
* @param autoStart whether to start the downloader after enqueing the chapters.
|
||||||
*/
|
*/
|
||||||
fun downloadChapters(manga: Manga, chapters: List<Chapter>) {
|
fun downloadChapters(manga: Manga, chapters: List<Chapter>, autoStart: Boolean = true) {
|
||||||
downloader.queueChapters(manga, chapters)
|
downloader.queueChapters(manga, chapters, autoStart)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,8 +219,9 @@ class Downloader(private val context: Context,
|
|||||||
*
|
*
|
||||||
* @param manga the manga of the chapters to download.
|
* @param manga the manga of the chapters to download.
|
||||||
* @param chapters the list of chapters to download.
|
* @param chapters the list of chapters to download.
|
||||||
|
* @param autoStart whether to start the downloader after enqueing the chapters.
|
||||||
*/
|
*/
|
||||||
fun queueChapters(manga: Manga, chapters: List<Chapter>) = launchUI {
|
fun queueChapters(manga: Manga, chapters: List<Chapter>, autoStart: Boolean) = launchUI {
|
||||||
val source = sourceManager.get(manga.source) as? HttpSource ?: return@launchUI
|
val source = sourceManager.get(manga.source) as? HttpSource ?: return@launchUI
|
||||||
|
|
||||||
// Called in background thread, the operation can be slow with SAF.
|
// Called in background thread, the operation can be slow with SAF.
|
||||||
@ -261,9 +262,11 @@ class Downloader(private val context: Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start downloader if needed
|
// Start downloader if needed
|
||||||
|
if (autoStart) {
|
||||||
DownloadService.start(this@Downloader.context)
|
DownloadService.start(this@Downloader.context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the observable which downloads a chapter.
|
* Returns the observable which downloads a chapter.
|
||||||
|
@ -333,7 +333,9 @@ class LibraryUpdateService(
|
|||||||
val dbChapters = chapters.map {
|
val dbChapters = chapters.map {
|
||||||
mangaChapters.find { mangaChapter -> mangaChapter.url == it.url }!!
|
mangaChapters.find { mangaChapter -> mangaChapter.url == it.url }!!
|
||||||
}
|
}
|
||||||
downloadManager.downloadChapters(manga, dbChapters)
|
// We don't want to start downloading while the library is updating, because websites
|
||||||
|
// may don't like it and they could ban the user.
|
||||||
|
downloadManager.downloadChapters(manga, dbChapters, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user