Add custom Thumbnail Url. Support backup & restore (#1059)
* Add custom thumbnail url. Support backup & restore - add custom thumbnail url in edit info/custom - include it in backup n restore * increase chop char * edit chop char again to match screenshoot * tweak truncating middle part * apply edited cover to history, updates , others * simplify placeholder logic --------- Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@ data class CustomMangaInfo(
|
||||
val title: String?,
|
||||
val author: String? = null,
|
||||
val artist: String? = null,
|
||||
val thumbnailUrl: String? = null,
|
||||
val description: String? = null,
|
||||
val genre: List<String>? = null,
|
||||
val status: Long? = null,
|
||||
|
||||
@@ -24,11 +24,11 @@ data class Manga(
|
||||
val ogTitle: String,
|
||||
val ogArtist: String?,
|
||||
val ogAuthor: String?,
|
||||
val ogThumbnailUrl: String?,
|
||||
val ogDescription: String?,
|
||||
val ogGenre: List<String>?,
|
||||
val ogStatus: Long,
|
||||
// SY <--
|
||||
val thumbnailUrl: String?,
|
||||
val updateStrategy: UpdateStrategy,
|
||||
val initialized: Boolean,
|
||||
val lastModifiedAt: Long,
|
||||
@@ -51,6 +51,9 @@ data class Manga(
|
||||
val artist: String?
|
||||
get() = customMangaInfo?.artist ?: ogArtist
|
||||
|
||||
val thumbnailUrl: String?
|
||||
get() = customMangaInfo?.thumbnailUrl ?: ogThumbnailUrl
|
||||
|
||||
val description: String?
|
||||
get() = customMangaInfo?.description ?: ogDescription
|
||||
|
||||
@@ -147,11 +150,11 @@ data class Manga(
|
||||
// SY -->
|
||||
ogArtist = null,
|
||||
ogAuthor = null,
|
||||
ogThumbnailUrl = null,
|
||||
ogDescription = null,
|
||||
ogGenre = null,
|
||||
ogStatus = 0L,
|
||||
// SY <--
|
||||
thumbnailUrl = null,
|
||||
updateStrategy = UpdateStrategy.ALWAYS_UPDATE,
|
||||
initialized = false,
|
||||
lastModifiedAt = 0L,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tachiyomi.domain.manga.model
|
||||
|
||||
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
/**
|
||||
* Contains the required data for MangaCoverFetcher
|
||||
*/
|
||||
@@ -7,16 +10,26 @@ data class MangaCover(
|
||||
val mangaId: Long,
|
||||
val sourceId: Long,
|
||||
val isMangaFavorite: Boolean,
|
||||
val url: String?,
|
||||
// SY -->
|
||||
val ogUrl: String?,
|
||||
// SY <--
|
||||
val lastModified: Long,
|
||||
)
|
||||
) {
|
||||
// SY -->
|
||||
val url: String = getCustomMangaInfo.get(mangaId)?.thumbnailUrl ?: ogUrl!!
|
||||
|
||||
companion object {
|
||||
private val getCustomMangaInfo: GetCustomMangaInfo by injectLazy()
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
|
||||
fun Manga.asMangaCover(): MangaCover {
|
||||
return MangaCover(
|
||||
mangaId = id,
|
||||
sourceId = source,
|
||||
isMangaFavorite = favorite,
|
||||
url = thumbnailUrl,
|
||||
ogUrl = thumbnailUrl,
|
||||
lastModified = coverLastModified,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ fun Manga.toMangaUpdate(): MangaUpdate {
|
||||
title = ogTitle,
|
||||
artist = ogArtist,
|
||||
author = ogAuthor,
|
||||
thumbnailUrl = ogThumbnailUrl,
|
||||
description = ogDescription,
|
||||
genre = ogGenre,
|
||||
status = ogStatus,
|
||||
// SY <--
|
||||
thumbnailUrl = thumbnailUrl,
|
||||
updateStrategy = updateStrategy,
|
||||
initialized = initialized,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user