mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Chapter Recognition for Read/Mintmanga (#682)
This commit is contained in:
parent
fd9c24413d
commit
bb723076ee
2 changed files with 30 additions and 2 deletions
|
@ -102,7 +102,21 @@ class Mintmanga : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||||
|
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
|
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> {
|
||||||
|
|
|
@ -102,7 +102,21 @@ class Readmanga : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||||
|
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
|
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> {
|
||||||
|
|
Loading…
Reference in a new issue