Fixes case where manga name ends with s. (#919)

This commit is contained in:
Bram van de Kerkhof 2017-07-31 20:04:14 +02:00 committed by GitHub
parent 6059b85e58
commit aefe7b176a
2 changed files with 12 additions and 1 deletions

View File

@ -29,7 +29,7 @@ object ChapterRecognition {
* Regex used to remove unwanted tags
* Example Prison School 12 v.1 vol004 version1243 volume64 -R> Prison School 12
*/
private val unwanted = Regex("""(?:(v|ver|vol|version|volume|season|s).?[0-9]+)""")
private val unwanted = Regex("""(?<![a-z])(v|ver|vol|version|volume|season|s).?[0-9]+""")
/**
* Regex used to remove unwanted whitespace

View File

@ -440,4 +440,15 @@ class ChapterRecognitionTest {
ChapterRecognition.parseChapterNumber(chapter, manga)
assertThat(chapter.chapter_number).isEqualTo(20f)
}
/**
* Test for chapters ending with s
*/
@Test fun chaptersEndingWithS() {
createManga("One Outs")
createChapter("One Outs 001")
ChapterRecognition.parseChapterNumber(chapter, manga)
assertThat(chapter.chapter_number).isEqualTo(1f)
}
}