mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Remove any mention of MangaJson outside CustomMangaManager
This commit is contained in:
parent
2283c7d5a8
commit
017ebe2f26
4 changed files with 53 additions and 28 deletions
|
@ -93,30 +93,14 @@ data class BackupManga(
|
||||||
customGenre != null ||
|
customGenre != null ||
|
||||||
customStatus != 0
|
customStatus != 0
|
||||||
) {
|
) {
|
||||||
return CustomMangaManager.ComicList.ComicInfoYokai(
|
return CustomMangaManager.ComicList.ComicInfoYokai.create(
|
||||||
id = 0L,
|
id = 0L,
|
||||||
value = ComicInfo(
|
title = customTitle,
|
||||||
title = null,
|
author = customAuthor,
|
||||||
series = customTitle?.let { ComicInfo.Series(it) },
|
artist = customArtist,
|
||||||
number = null,
|
description = customDescription,
|
||||||
writer = customAuthor?.let { ComicInfo.Writer(it) },
|
genre = customGenre?.toTypedArray(),
|
||||||
penciller = customArtist?.let { ComicInfo.Penciller(it) },
|
status = customStatus,
|
||||||
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
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import dev.yokai.core.metadata.COMIC_INFO_EDITS_FILE
|
import dev.yokai.core.metadata.COMIC_INFO_EDITS_FILE
|
||||||
import dev.yokai.core.metadata.ComicInfo
|
import dev.yokai.core.metadata.ComicInfo
|
||||||
|
import dev.yokai.core.metadata.ComicInfoPublishingStatus
|
||||||
import dev.yokai.core.metadata.copyFromComicInfo
|
import dev.yokai.core.metadata.copyFromComicInfo
|
||||||
import dev.yokai.core.metadata.toComicInfo
|
import dev.yokai.core.metadata.toComicInfo
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
|
@ -177,7 +178,47 @@ class CustomMangaManager(val context: Context) {
|
||||||
data class ComicInfoYokai(
|
data class ComicInfoYokai(
|
||||||
@XmlValue(true) val value: ComicInfo,
|
@XmlValue(true) val value: ComicInfo,
|
||||||
var id: Long? = null,
|
var id: Long? = null,
|
||||||
)
|
) {
|
||||||
|
companion object {
|
||||||
|
fun create(
|
||||||
|
id: Long? = null,
|
||||||
|
title: String? = null,
|
||||||
|
author: String? = null,
|
||||||
|
artist: String? = null,
|
||||||
|
description: String? = null,
|
||||||
|
genre: Array<String>? = null,
|
||||||
|
status: Int? = null,
|
||||||
|
): ComicInfoYokai {
|
||||||
|
return ComicInfoYokai(
|
||||||
|
id = id,
|
||||||
|
value = ComicInfo(
|
||||||
|
title = null,
|
||||||
|
series = title?.let { ComicInfo.Series(it) },
|
||||||
|
number = null,
|
||||||
|
writer = author?.let { ComicInfo.Writer(it) },
|
||||||
|
penciller = artist?.let { ComicInfo.Penciller(it) },
|
||||||
|
inker = null,
|
||||||
|
colorist = null,
|
||||||
|
letterer = null,
|
||||||
|
coverArtist = null,
|
||||||
|
translator = null,
|
||||||
|
summary = description?.let { ComicInfo.Summary(it) },
|
||||||
|
genre = genre?.joinToString(", ")?.let { ComicInfo.Genre(it) },
|
||||||
|
tags = null,
|
||||||
|
web = null,
|
||||||
|
publishingStatus = status.takeUnless { it == 0 }?.let {
|
||||||
|
ComicInfo.PublishingStatusTachiyomi(
|
||||||
|
ComicInfoPublishingStatus.toComicInfoValue(it.toLong())
|
||||||
|
)
|
||||||
|
},
|
||||||
|
categories = null,
|
||||||
|
source = null,
|
||||||
|
language = null,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mangaFromComicInfoObject(id: Long, comicInfo: ComicInfo) = MangaImpl().apply {
|
private fun mangaFromComicInfoObject(id: Long, comicInfo: ComicInfo) = MangaImpl().apply {
|
||||||
|
|
|
@ -246,7 +246,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
||||||
|
|
||||||
lang?.let { langMap[manga.url] = it }
|
lang?.let { langMap[manga.url] = it }
|
||||||
val file = directory.createFile(COMIC_INFO_FILE)!!
|
val file = directory.createFile(COMIC_INFO_FILE)!!
|
||||||
file.writeText(xml.encodeToString(ComicInfo.serializer(), manga.toComicInfo(lang)))
|
file.writeText(xml.encodeToString(ComicInfo.serializer(), manga.toComicInfo(lang = lang)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|
|
@ -712,7 +712,7 @@ class MangaDetailsPresenter(
|
||||||
fun confirmDeletion() {
|
fun confirmDeletion() {
|
||||||
launchIO {
|
launchIO {
|
||||||
coverCache.deleteFromCache(manga)
|
coverCache.deleteFromCache(manga)
|
||||||
customMangaManager.saveMangaInfo(CustomMangaManager.MangaJson(manga.id!!))
|
customMangaManager.saveMangaInfo(CustomMangaManager.ComicList.ComicInfoYokai.create(manga.id!!))
|
||||||
downloadManager.deleteManga(manga, source)
|
downloadManager.deleteManga(manga, source)
|
||||||
asyncUpdateMangaAndChapters(true)
|
asyncUpdateMangaAndChapters(true)
|
||||||
}
|
}
|
||||||
|
@ -797,8 +797,8 @@ class MangaDetailsPresenter(
|
||||||
manga.viewer_flags = -1
|
manga.viewer_flags = -1
|
||||||
db.updateViewerFlags(manga).executeAsBlocking()
|
db.updateViewerFlags(manga).executeAsBlocking()
|
||||||
}
|
}
|
||||||
val manga = CustomMangaManager.MangaJson(
|
val manga = CustomMangaManager.ComicList.ComicInfoYokai.create(
|
||||||
manga.id!!,
|
id = manga.id!!,
|
||||||
title?.trimOrNull(),
|
title?.trimOrNull(),
|
||||||
author?.trimOrNull(),
|
author?.trimOrNull(),
|
||||||
artist?.trimOrNull(),
|
artist?.trimOrNull(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue