mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-11 11:20:49 +01:00
handle chapter versions which are attached to the chapter number
This commit is contained in:
parent
ea130a0899
commit
5977e9f47f
2 changed files with 8 additions and 2 deletions
|
@ -15,7 +15,7 @@ public class ChapterRecognition {
|
||||||
private static final Pattern p3 = Pattern.compile("(\\d+[\\.,]?\\d*\\s*:)");
|
private static final Pattern p3 = Pattern.compile("(\\d+[\\.,]?\\d*\\s*:)");
|
||||||
|
|
||||||
private static final Pattern pUnwanted =
|
private static final Pattern pUnwanted =
|
||||||
Pattern.compile("\\b(v|ver|vol|version|volume)\\.?\\s*\\d+\\b");
|
Pattern.compile("(\\b|\\d)(v|ver|vol|version|volume)\\.?\\s*\\d+\\b");
|
||||||
|
|
||||||
public static void parseChapterNumber(Chapter chapter, Manga manga) {
|
public static void parseChapterNumber(Chapter chapter, Manga manga) {
|
||||||
if (chapter.chapter_number != -1)
|
if (chapter.chapter_number != -1)
|
||||||
|
@ -32,7 +32,7 @@ public class ChapterRecognition {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove anything related to the volume or version
|
// Remove anything related to the volume or version
|
||||||
name = pUnwanted.matcher(name).replaceAll("");
|
name = pUnwanted.matcher(name).replaceAll("$1");
|
||||||
|
|
||||||
List<Float> occurrences;
|
List<Float> occurrences;
|
||||||
|
|
||||||
|
|
|
@ -135,4 +135,10 @@ public class ChapterRecognitionTest {
|
||||||
assertThat(c.chapter_number).isEqualTo(28f);
|
assertThat(c.chapter_number).isEqualTo(28f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithVolumeAttachedToChapter() {
|
||||||
|
Chapter c = createChapter("Ansatsu Kyoushitsu 011v002: Assembly Time");
|
||||||
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
|
assertThat(c.chapter_number).isEqualTo(11f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue