Chapter Recognition for Read/Mintmanga (#682)

This commit is contained in:
Taumer 2017-02-12 21:43:00 +03:00 committed by inorichi
parent fd9c24413d
commit bb723076ee
2 changed files with 30 additions and 2 deletions

View file

@ -102,7 +102,21 @@ class Mintmanga : ParsedHttpSource() {
} }
override fun prepareNewChapter(chapter: SChapter, manga: SManga) { override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
chapter.chapter_number = -2f val basic = Regex("""\s([0-9]+)(\s-\s)([0-9]+)\s*""")
val extra = Regex("""\s([0-9]+\sЭкстра)\s*""")
val single = Regex("""\sСингл\s*""")
when {
basic.containsMatchIn(chapter.name) -> {
basic.find(chapter.name)?.let {
val number = it.groups[3]?.value!!
chapter.chapter_number = number.toFloat()
}
}
extra.containsMatchIn(chapter.name) -> // Extra chapters doesn't contain chapter number
chapter.chapter_number = -2f
single.containsMatchIn(chapter.name) -> // Oneshoots, doujinshi and other mangas with one chapter
chapter.chapter_number = 1f
}
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {

View file

@ -102,7 +102,21 @@ class Readmanga : ParsedHttpSource() {
} }
override fun prepareNewChapter(chapter: SChapter, manga: SManga) { override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
chapter.chapter_number = -2f val basic = Regex("""\s([0-9]+)(\s-\s)([0-9]+)\s*""")
val extra = Regex("""\s([0-9]+\sЭкстра)\s*""")
val single = Regex("""\sСингл\s*""")
when {
basic.containsMatchIn(chapter.name) -> {
basic.find(chapter.name)?.let {
val number = it.groups[3]?.value!!
chapter.chapter_number = number.toFloat()
}
}
extra.containsMatchIn(chapter.name) -> // Extra chapters doesn't contain chapter number
chapter.chapter_number = -2f
single.containsMatchIn(chapter.name) -> // Oneshoots, doujinshi and other mangas with one chapter
chapter.chapter_number = 1f
}
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {