mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-02 07:08:55 +01:00
Better handle decimal chapter numbers and add categories in ComicInfo.xml files (#9604)
* Serialize whole chapter numbers without decimal point and add library categories to genre * added Tachiyomi specific ComicInfo Category field * lint * implemented requested changes
This commit is contained in:
@@ -50,6 +50,7 @@ import tachiyomi.core.util.lang.withIOContext
|
||||
import tachiyomi.core.util.lang.withUIContext
|
||||
import tachiyomi.core.util.system.ImageUtil
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.domain.category.interactor.GetCategories
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.download.service.DownloadPreferences
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
@@ -75,6 +76,7 @@ class Downloader(
|
||||
private val chapterCache: ChapterCache = Injekt.get(),
|
||||
private val downloadPreferences: DownloadPreferences = Injekt.get(),
|
||||
private val xml: XML = Injekt.get(),
|
||||
private val getCategories: GetCategories = Injekt.get(),
|
||||
) {
|
||||
|
||||
/**
|
||||
@@ -621,14 +623,15 @@ class Downloader(
|
||||
/**
|
||||
* Creates a ComicInfo.xml file inside the given directory.
|
||||
*/
|
||||
private fun createComicInfoFile(
|
||||
private suspend fun createComicInfoFile(
|
||||
dir: UniFile,
|
||||
manga: Manga,
|
||||
chapter: Chapter,
|
||||
source: HttpSource,
|
||||
) {
|
||||
val chapterUrl = source.getChapterUrl(chapter.toSChapter())
|
||||
val comicInfo = getComicInfo(manga, chapter, chapterUrl)
|
||||
val categories = getCategories.await(manga.id).map { it.name.trim() }.takeUnless { it.isEmpty() }
|
||||
val comicInfo = getComicInfo(manga, chapter, chapterUrl, categories)
|
||||
// Remove the old file
|
||||
dir.findFile(COMIC_INFO_FILE)?.delete()
|
||||
dir.createFile(COMIC_INFO_FILE).openOutputStream().use {
|
||||
|
||||
Reference in New Issue
Block a user