mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 23:29:16 +01:00
prefer numbers at the start of the chapter title if otherwise unparsed
This commit is contained in:
parent
5e834ae3be
commit
eee137a084
@ -122,6 +122,19 @@ public class ChapterRecognition {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// check for a number either at the start or right after the manga title
|
||||||
|
matcher = startingNumber.matcher(name);
|
||||||
|
if (matcher.find()) {
|
||||||
|
chapter.chapter_number = Float.parseFloat(matcher.group(1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
matcher = startingNumber.matcher(nameWithoutManga);
|
||||||
|
if (matcher.find()) {
|
||||||
|
chapter.chapter_number = Float.parseFloat(matcher.group(1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,4 +186,13 @@ public class ChapterRecognitionTest {
|
|||||||
ChapterRecognition.parseChapterNumber(c, randomManga);
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
assertThat(c.chapter_number).isEqualTo(404f);
|
assertThat(c.chapter_number).isEqualTo(404f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPlainNumberInTitle() {
|
||||||
|
Chapter c = createChapter("Kuroko no Basket 002 Monday at 840 on the Rooftop");
|
||||||
|
Manga manga = new Manga();
|
||||||
|
manga.title = "Kuroko no Basket";
|
||||||
|
ChapterRecognition.parseChapterNumber(c, manga);
|
||||||
|
assertThat(c.chapter_number).isEqualTo(2f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user