mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: BackupManga should also use ComicInfo
This commit is contained in:
parent
96c3c3cc9a
commit
2283c7d5a8
3 changed files with 38 additions and 20 deletions
|
@ -198,7 +198,7 @@ class BackupRestorer(val context: Context, val notifier: BackupNotifier) {
|
||||||
tracks: List<Track>,
|
tracks: List<Track>,
|
||||||
backupCategories: List<BackupCategory>,
|
backupCategories: List<BackupCategory>,
|
||||||
filteredScanlators: List<String>,
|
filteredScanlators: List<String>,
|
||||||
customManga: CustomMangaManager.MangaJson?,
|
customManga: CustomMangaManager.ComicList.ComicInfoYokai?,
|
||||||
) {
|
) {
|
||||||
val fetchedManga = manga.also {
|
val fetchedManga = manga.also {
|
||||||
it.initialized = it.description != null
|
it.initialized = it.description != null
|
||||||
|
@ -218,7 +218,7 @@ class BackupRestorer(val context: Context, val notifier: BackupNotifier) {
|
||||||
tracks: List<Track>,
|
tracks: List<Track>,
|
||||||
backupCategories: List<BackupCategory>,
|
backupCategories: List<BackupCategory>,
|
||||||
filteredScanlators: List<String>,
|
filteredScanlators: List<String>,
|
||||||
customManga: CustomMangaManager.MangaJson?,
|
customManga: CustomMangaManager.ComicList.ComicInfoYokai?,
|
||||||
) {
|
) {
|
||||||
restoreChapters(backupManga, chapters)
|
restoreChapters(backupManga, chapters)
|
||||||
restoreExtras(backupManga, categories, history, tracks, backupCategories, filteredScanlators, customManga)
|
restoreExtras(backupManga, categories, history, tracks, backupCategories, filteredScanlators, customManga)
|
||||||
|
@ -258,7 +258,7 @@ class BackupRestorer(val context: Context, val notifier: BackupNotifier) {
|
||||||
tracks: List<Track>,
|
tracks: List<Track>,
|
||||||
backupCategories: List<BackupCategory>,
|
backupCategories: List<BackupCategory>,
|
||||||
filteredScanlators: List<String>,
|
filteredScanlators: List<String>,
|
||||||
customManga: CustomMangaManager.MangaJson?,
|
customManga: CustomMangaManager.ComicList.ComicInfoYokai?,
|
||||||
) {
|
) {
|
||||||
restoreCategories(manga, categories, backupCategories)
|
restoreCategories(manga, categories, backupCategories)
|
||||||
restoreHistoryForManga(history)
|
restoreHistoryForManga(history)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.data.backup.models
|
package eu.kanade.tachiyomi.data.backup.models
|
||||||
|
|
||||||
|
import dev.yokai.core.metadata.ComicInfo
|
||||||
|
import dev.yokai.core.metadata.ComicInfoPublishingStatus
|
||||||
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||||
|
@ -83,7 +85,7 @@ data class BackupManga(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCustomMangaInfo(): CustomMangaManager.MangaJson? {
|
fun getCustomMangaInfo(): CustomMangaManager.ComicList.ComicInfoYokai? {
|
||||||
if (customTitle != null ||
|
if (customTitle != null ||
|
||||||
customArtist != null ||
|
customArtist != null ||
|
||||||
customAuthor != null ||
|
customAuthor != null ||
|
||||||
|
@ -91,14 +93,30 @@ data class BackupManga(
|
||||||
customGenre != null ||
|
customGenre != null ||
|
||||||
customStatus != 0
|
customStatus != 0
|
||||||
) {
|
) {
|
||||||
return CustomMangaManager.MangaJson(
|
return CustomMangaManager.ComicList.ComicInfoYokai(
|
||||||
id = 0L,
|
id = 0L,
|
||||||
title = customTitle,
|
value = ComicInfo(
|
||||||
author = customAuthor,
|
title = null,
|
||||||
artist = customArtist,
|
series = customTitle?.let { ComicInfo.Series(it) },
|
||||||
description = customDescription,
|
number = null,
|
||||||
genre = customGenre?.toTypedArray(),
|
writer = customAuthor?.let { ComicInfo.Writer(it) },
|
||||||
status = customStatus.takeUnless { it == 0 },
|
penciller = customArtist?.let { ComicInfo.Penciller(it) },
|
||||||
|
inker = null,
|
||||||
|
colorist = null,
|
||||||
|
letterer = null,
|
||||||
|
coverArtist = null,
|
||||||
|
translator = null,
|
||||||
|
summary = customDescription?.let { ComicInfo.Summary(it) },
|
||||||
|
genre = customGenre?.joinToString(", ")?.let { ComicInfo.Genre(it) },
|
||||||
|
tags = null,
|
||||||
|
web = null,
|
||||||
|
publishingStatus = customStatus.takeUnless { it == 0 }?.let { ComicInfo.PublishingStatusTachiyomi(
|
||||||
|
ComicInfoPublishingStatus.toComicInfoValue(status.toLong())
|
||||||
|
) },
|
||||||
|
categories = null,
|
||||||
|
source = null,
|
||||||
|
language = null,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -102,18 +102,18 @@ class CustomMangaManager(val context: Context) {
|
||||||
saveCustomInfo { jsonFile.delete() }
|
saveCustomInfo { jsonFile.delete() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveMangaInfo(manga: MangaJson) {
|
fun saveMangaInfo(manga: ComicList.ComicInfoYokai) {
|
||||||
val mangaId = manga.id ?: return
|
val mangaId = manga.id ?: return
|
||||||
if (manga.title == null &&
|
if (manga.value.series == null &&
|
||||||
manga.author == null &&
|
manga.value.writer == null &&
|
||||||
manga.artist == null &&
|
manga.value.penciller == null &&
|
||||||
manga.description == null &&
|
manga.value.summary == null &&
|
||||||
manga.genre == null &&
|
manga.value.genre == null &&
|
||||||
(manga.status ?: -1) == -1
|
(manga.value.publishingStatus?.value ?: "Invalid") == "Invalid"
|
||||||
) {
|
) {
|
||||||
customMangaMap.remove(mangaId)
|
customMangaMap.remove(mangaId)
|
||||||
} else {
|
} else {
|
||||||
customMangaMap[mangaId] = manga.toManga()
|
customMangaMap[mangaId] = mangaFromComicInfoObject(mangaId, manga.value)
|
||||||
}
|
}
|
||||||
saveCustomInfo()
|
saveCustomInfo()
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ class CustomMangaManager(val context: Context) {
|
||||||
@XmlSerialName("ComicInfoYokai", "http://www.w3.org/2001/XMLSchema", "yk")
|
@XmlSerialName("ComicInfoYokai", "http://www.w3.org/2001/XMLSchema", "yk")
|
||||||
data class ComicInfoYokai(
|
data class ComicInfoYokai(
|
||||||
@XmlValue(true) val value: ComicInfo,
|
@XmlValue(true) val value: ComicInfo,
|
||||||
val id: Long? = null,
|
var id: Long? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue