minor adjustments to ChapterRecognition

This commit is contained in:
Jays2Kings 2022-05-23 13:18:25 -04:00
parent dbc7098820
commit e6782a63a2

View file

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.util.chapter
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import java.util.Locale
/** /**
* -R> = regex conversion. * -R> = regex conversion.
@ -45,7 +44,7 @@ object ChapterRecognition {
} }
// Get chapter title with lower case // Get chapter title with lower case
var name = chapter.name.lowercase(Locale.getDefault()) var name = chapter.name.lowercase()
// Remove comma's from chapter. // Remove comma's from chapter.
name = name.replace(',', '.') name = name.replace(',', '.')
@ -78,7 +77,7 @@ object ChapterRecognition {
} }
// Remove manga title from chapter title. // Remove manga title from chapter title.
val nameWithoutManga = name.replace(manga.originalTitle.lowercase(Locale.getDefault()), "").trim() val nameWithoutManga = name.replace(manga.originalTitle.lowercase(), "").trim()
// Check if first value is number after title remove. // Check if first value is number after title remove.
if (updateChapter(withoutManga.find(nameWithoutManga), chapter)) { if (updateChapter(withoutManga.find(nameWithoutManga), chapter)) {
@ -133,11 +132,11 @@ object ChapterRecognition {
return .97f return .97f
} }
if (alpha[0] == '.') { return if (alpha[0] == '.') {
// Take value after (.) // Take value after (.)
return parseAlphaPostFix(alpha[1]) parseAlphaPostFix(alpha[1])
} else { } else {
return parseAlphaPostFix(alpha[0]) parseAlphaPostFix(alpha[0])
} }
} }