Update title when refreshing the manga
This commit is contained in:
parent
4ce66fecb9
commit
441368442e
@ -7,6 +7,7 @@ import eu.kanade.domain.manga.model.isLocal
|
|||||||
import eu.kanade.domain.manga.model.toDbManga
|
import eu.kanade.domain.manga.model.toDbManga
|
||||||
import eu.kanade.domain.manga.repository.MangaRepository
|
import eu.kanade.domain.manga.repository.MangaRepository
|
||||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import tachiyomi.source.model.MangaInfo
|
import tachiyomi.source.model.MangaInfo
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
@ -29,9 +30,16 @@ class UpdateManga(
|
|||||||
remoteManga: MangaInfo,
|
remoteManga: MangaInfo,
|
||||||
manualFetch: Boolean,
|
manualFetch: Boolean,
|
||||||
coverCache: CoverCache = Injekt.get(),
|
coverCache: CoverCache = Injekt.get(),
|
||||||
|
// SY -->
|
||||||
|
downloadManager: DownloadManager = Injekt.get(),
|
||||||
|
// SY <--
|
||||||
): Boolean {
|
): Boolean {
|
||||||
// if the manga isn't a favorite, set its title from source and update in db
|
// SY -->
|
||||||
val title = if (!localManga.favorite) remoteManga.title else null
|
val title = if (remoteManga.title.isNotBlank() && localManga.ogTitle != remoteManga.title) {
|
||||||
|
downloadManager.renameMangaDir(localManga.ogTitle, remoteManga.title, localManga.source)
|
||||||
|
remoteManga.title
|
||||||
|
} else null
|
||||||
|
// SY <--
|
||||||
|
|
||||||
// Never refresh covers if the url is empty to avoid "losing" existing covers
|
// Never refresh covers if the url is empty to avoid "losing" existing covers
|
||||||
val updateCover = remoteManga.cover.isNotEmpty() && (manualFetch || localManga.thumbnailUrl != remoteManga.cover)
|
val updateCover = remoteManga.cover.isNotEmpty() && (manualFetch || localManga.thumbnailUrl != remoteManga.cover)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user