Skip to content

Commit

Permalink
improve(Suwayomi#733): re-added recognize chap number
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre JOURNET committed Oct 30, 2023
1 parent 04cc440 commit 1c0aa43
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package suwayomi.tachidesk.manga.impl
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.chapter.ChapterRecognition
import kotlinx.serialization.Serializable
import mu.KotlinLogging
import org.jetbrains.exposed.dao.id.EntityID
Expand Down Expand Up @@ -120,6 +121,14 @@ object Chapter {

val numberOfCurrentChapters = getCountOfMangaChapters(mangaId)
val chapterList = source.getChapterList(sManga)

// Recognize number for new chapters.
chapterList.forEach { chapter ->
(source as? HttpSource)?.prepareNewChapter(chapter, sManga)
val chapterNumber = ChapterRecognition.parseChapterNumber(manga.title, chapter.name, chapter.chapter_number.toDouble())
chapter.chapter_number = chapterNumber.toFloat()
}

val now = Instant.now().epochSecond
val chaptersInDb =
transaction {
Expand Down

0 comments on commit 1c0aa43

Please sign in to comment.