Merge pull request #323 from NoodleMage/season
Added chapter recognition for "season" case
This commit is contained in:
commit
7bfdfee27b
@ -29,8 +29,12 @@ object ChapterRecognition {
|
|||||||
* Regex used to remove unwanted tags
|
* Regex used to remove unwanted tags
|
||||||
* Example Prison School 12 v.1 vol004 version1243 volume64 -R> Prison School 12
|
* Example Prison School 12 v.1 vol004 version1243 volume64 -R> Prison School 12
|
||||||
*/
|
*/
|
||||||
private val unwanted = Regex("""(?:(v|ver|vol|version|volume).?[0-9]+)""")
|
private val unwanted = Regex("""(?:(v|ver|vol|version|volume|season).?[0-9]+)""")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regex used to remove unwanted whitespace
|
||||||
|
* Example One Piece 12 special -R> One Piece 12special
|
||||||
|
*/
|
||||||
private val unwantedWhiteSpace = Regex("""(\s)(extra|special|omake)""")
|
private val unwantedWhiteSpace = Regex("""(\s)(extra|special|omake)""")
|
||||||
|
|
||||||
fun parseChapterNumber(chapter: Chapter, manga: Manga) {
|
fun parseChapterNumber(chapter: Chapter, manga: Manga) {
|
||||||
|
@ -418,4 +418,15 @@ class ChapterRecognitionTest {
|
|||||||
assertThat(chapter.chapter_number).isEqualTo(24.005f)
|
assertThat(chapter.chapter_number).isEqualTo(24.005f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for chapters containing season
|
||||||
|
*/
|
||||||
|
@Test fun chapterContainingSeasonCase() {
|
||||||
|
createManga("D.I.C.E")
|
||||||
|
|
||||||
|
createChapter("D.I.C.E[Season 001] Ep. 007")
|
||||||
|
ChapterRecognition.parseChapterNumber(chapter, manga)
|
||||||
|
assertThat(chapter.chapter_number).isEqualTo(7f)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user