From 4f5518bdd88bcc8fd9768dea908f2d4f3fba68c0 Mon Sep 17 00:00:00 2001 From: Bram van de Kerkhof Date: Thu, 20 Oct 2016 16:28:25 +0200 Subject: [PATCH] Fixed wrong chapter recognition for S0 - Chapter 00 (#499) --- .../eu/kanade/tachiyomi/util/ChapterRecognition.kt | 2 +- .../tachiyomi/data/database/ChapterRecognitionTest.kt | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterRecognition.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterRecognition.kt index 5330978ea..ff0a2c359 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterRecognition.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterRecognition.kt @@ -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).?[0-9]+)""") + private val unwanted = Regex("""(?:(v|ver|vol|version|volume|season|s).?[0-9]+)""") /** * Regex used to remove unwanted whitespace diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt b/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt index afc02e35e..59712b7c6 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt @@ -429,4 +429,15 @@ class ChapterRecognitionTest { assertThat(chapter.chapter_number).isEqualTo(7f) } + + /** + * Test for chapters in format sx - chapter xx + */ + @Test fun chapterContainingSeasonCase2() { + createManga("The Gamer") + + createChapter("S3 - Chapter 20") + ChapterRecognition.parseChapterNumber(chapter, manga) + assertThat(chapter.chapter_number).isEqualTo(20f) + } }