More cases for parsing regex

This commit is contained in:
Joseph Milazzo 2021-03-28 12:43:35 -05:00
parent 7e54d332f5
commit c74b4c36c1
3 changed files with 5 additions and 1 deletions

View File

@ -146,6 +146,8 @@ namespace API.Tests
[InlineData("VanDread-v01-c001[MD].zip", "1")] [InlineData("VanDread-v01-c001[MD].zip", "1")]
[InlineData("Goblin Slayer Side Story - Year One 025.5", "25.5")] [InlineData("Goblin Slayer Side Story - Year One 025.5", "25.5")]
[InlineData("Kedouin Makoto - Corpse Party Musume, Chapter 01", "1")] [InlineData("Kedouin Makoto - Corpse Party Musume, Chapter 01", "1")]
[InlineData("To Love Ru v11 Uncensored (Ch.089-097+Omake)", "89-97")]
[InlineData("To Love Ru v18 Uncensored (Ch.153-162.5)", "153-162.5")]
public void ParseChaptersTest(string filename, string expected) public void ParseChaptersTest(string filename, string expected)
{ {
Assert.Equal(expected, ParseChapter(filename)); Assert.Equal(expected, ParseChapter(filename));
@ -236,6 +238,7 @@ namespace API.Tests
[InlineData("Scott Pilgrim 01 - Scott Pilgrim's Precious Little Life (2004)", "Scott Pilgrim")] [InlineData("Scott Pilgrim 01 - Scott Pilgrim's Precious Little Life (2004)", "Scott Pilgrim")]
[InlineData("Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)", "Teen Titans")] [InlineData("Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)", "Teen Titans")]
[InlineData("Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005)", "Scott Pilgrim")] [InlineData("Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005)", "Scott Pilgrim")]
[InlineData("Wolverine - Origins 003 (2006) (digital) (Minutemen-PhD)", "Wolverine - Origins")]
public void ParseComicSeriesTest(string filename, string expected) public void ParseComicSeriesTest(string filename, string expected)
{ {
Assert.Equal(expected, ParseComicSeries(filename)); Assert.Equal(expected, ParseComicSeries(filename));

BIN
API/Data/kavita.db Normal file

Binary file not shown.

View File

@ -223,8 +223,9 @@ namespace API.Parser
private static readonly Regex[] MangaChapterRegex = new[] private static readonly Regex[] MangaChapterRegex = new[]
{ {
// Historys Strongest Disciple Kenichi_v11_c90-98.zip, ...c90.5-100.5
new Regex( new Regex(
@"(c|ch)(\.? ?)(?<Chapter>\d+(?:.\d+|-\d+)?)", @"(c|ch)(\.? ?)(?<Chapter>(\d+(\.\d)?)-?(\d+(\.\d)?)?)",
RegexOptions.IgnoreCase | RegexOptions.Compiled), RegexOptions.IgnoreCase | RegexOptions.Compiled),
// [Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip // [Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip
new Regex( new Regex(