mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-30 15:34:15 +01:00
Fix/local manga thumbnails handling (#1630)
* Skip thumbnail download for local manga sources Local manga sources do not require downloading thumbnails as they are stored locally. * Always update local source manga info when browsing When making changes to an in library local source manga, a refresh from the source was required to get the latest data. From a user perspective, this is unexpected behavior that looks like a bug. If, for example, the thumbnail file extension got changed, the file could not be found anymore and an error was shown in the client. To fix this, a manga refresh was required.
This commit is contained in:
@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.impl
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import eu.kanade.tachiyomi.source.local.LocalSource
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
@@ -75,6 +76,19 @@ object Library {
|
||||
inLibrary: Boolean,
|
||||
) {
|
||||
scope.launch {
|
||||
val sourceId =
|
||||
transaction {
|
||||
MangaTable
|
||||
.select(MangaTable.sourceReference)
|
||||
.where { MangaTable.id eq mangaId }
|
||||
.first()
|
||||
.get(MangaTable.sourceReference)
|
||||
}
|
||||
|
||||
if (sourceId == LocalSource.ID) {
|
||||
return@launch
|
||||
}
|
||||
|
||||
try {
|
||||
if (inLibrary) {
|
||||
ThumbnailDownloadHelper.download(mangaId)
|
||||
|
||||
@@ -7,6 +7,7 @@ package suwayomi.tachidesk.manga.impl
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import eu.kanade.tachiyomi.source.local.LocalSource
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
import org.jetbrains.exposed.dao.id.EntityID
|
||||
import org.jetbrains.exposed.sql.and
|
||||
@@ -83,7 +84,7 @@ object MangaList {
|
||||
.mapNotNull { sManga ->
|
||||
existingMangaUrlsToId[sManga.url]?.let { sManga to it }
|
||||
}.filterNot { (_, resultRow) ->
|
||||
resultRow[MangaTable.inLibrary]
|
||||
resultRow[MangaTable.inLibrary] && resultRow[MangaTable.sourceReference] != LocalSource.ID
|
||||
}
|
||||
|
||||
if (mangaToUpdate.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user