no online fetch on backup

This commit is contained in:
Aria Moradi
2022-02-19 02:45:30 +03:30
parent df7938037e
commit 09af582b1a
2 changed files with 6 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ import java.time.Instant
object Chapter {
/** get chapter list when showing a manga */
suspend fun getChapterList(mangaId: Int, onlineFetch: Boolean = false): List<ChapterDataClass> {
suspend fun getChapterList(mangaId: Int, onlineFetch: Boolean = false, onlineFetchOnEmpty: Boolean = true): List<ChapterDataClass> {
return if (onlineFetch) {
getSourceChapters(mangaId)
} else {
@@ -47,7 +47,10 @@ object Chapter {
ChapterTable.toDataClass(it)
}
}.ifEmpty {
getSourceChapters(mangaId)
if (onlineFetchOnEmpty)
getSourceChapters(mangaId)
else
emptyList()
}
}
}

View File

@@ -76,7 +76,7 @@ object ProtoBackupExport : ProtoBackupBase() {
val mangaId = mangaRow[MangaTable.id].value
if (flags.includeChapters) {
val chapters = runBlocking { Chapter.getChapterList(mangaId) }
val chapters = runBlocking { Chapter.getChapterList(mangaId, onlineFetchOnEmpty = false) }
backupManga.chapters = chapters.map {
BackupChapter(
it.url,