diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs index e1b143272..31e1b89d5 100644 --- a/API.Tests/Parser/MangaParserTests.cs +++ b/API.Tests/Parser/MangaParserTests.cs @@ -53,7 +53,7 @@ namespace API.Tests.Parser [InlineData("Kedouin Makoto - Corpse Party Musume, Chapter 12 [Dametrans][v2]", "0")] [InlineData("Vagabond_v03", "3")] [InlineData("Mujaki No Rakune Volume 10.cbz", "10")] - [InlineData("Umineko no Naku Koro ni - Episode 3 - Banquet of the Golden Witch #02.cbz", "3")] + [InlineData("Umineko no Naku Koro ni - Episode 3 - Banquet of the Golden Witch #02.cbz", "0")] [InlineData("Volume 12 - Janken Boy is Coming!.cbz", "12")] [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "20")] [InlineData("Gantz.V26.cbz", "26")] @@ -61,6 +61,9 @@ namespace API.Tests.Parser [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "1")] [InlineData("NEEDLESS_Vol.4_-_Simeon_6_v2_[SugoiSugoi].rar", "4")] [InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "1")] + [InlineData("Sword Art Online Vol 10 - Alicization Running [Yen Press] [LuCaZ] {r2}.epub", "10")] + [InlineData("Noblesse - Episode 406 (52 Pages).7z", "0")] + [InlineData("X-Men v1 #201 (September 2007).cbz", "1")] public void ParseVolumeTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename)); @@ -136,7 +139,11 @@ namespace API.Tests.Parser [InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "Okusama wa Shougakusei")] [InlineData("VanDread-v01-c001[MD].zip", "VanDread")] [InlineData("Momo The Blood Taker - Chapter 027 Violent Emotion.cbz", "Momo The Blood Taker")] + [InlineData("Kiss x Sis - Ch.15 - The Angst of a 15 Year Old Boy.cbz", "Kiss x Sis")] [InlineData("Green Worldz - Chapter 112 Final Chapter (End).cbz", "Green Worldz")] + [InlineData("Noblesse - Episode 406 (52 Pages).7z", "Noblesse")] + [InlineData("X-Men v1 #201 (September 2007).cbz", "X-Men")] + [InlineData("Kodoja #001 (March 2016)", "Kodoja")] public void ParseSeriesTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename)); @@ -197,7 +204,12 @@ namespace API.Tests.Parser [InlineData("Kiss x Sis - Ch.00 - Let's Start from 0.cbz", "0")] [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "2")] [InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "3")] + [InlineData("Kiss x Sis - Ch.15 - The Angst of a 15 Year Old Boy.cbz", "15")] [InlineData("Tomogui Kyoushitsu - Chapter 006 Game 005 - Fingernails On Right Hand (Part 002).cbz", "6")] + [InlineData("Noblesse - Episode 406 (52 Pages).7z", "406")] + [InlineData("X-Men v1 #201 (September 2007).cbz", "201")] + [InlineData("Kodoja #001 (March 2016)", "1")] + [InlineData("Noblesse - Episode 429 (74 Pages).7z", "429")] public void ParseChaptersTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseChapter(filename)); @@ -226,6 +238,7 @@ namespace API.Tests.Parser [InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Extra Chapter", true)] [InlineData("Ani-Hina Art Collection.cbz", true)] [InlineData("Gifting The Wonderful World With Blessings! - 3 Side Stories [yuNS][Unknown]", true)] + [InlineData("A Town Where You Live - Bonus Chapter.zip", true)] [InlineData("Yuki Merry - 4-Komga Anthology", true)] public void ParseMangaSpecialTest(string input, bool expected) { diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index 3cffb87e6..23f9b70c5 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -52,10 +52,10 @@ namespace API.Parser new Regex( @"(?.*)(\b|_|)(S(?\d+))", RegexOptions.IgnoreCase | RegexOptions.Compiled), - // Umineko no Naku Koro ni - Episode 3 - Banquet of the Golden Witch #02.cbz - new Regex( - @"(?.*)( |_|-)(?:Episode)(?: |_)(?\d+(-\d+)?)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Umineko no Naku Koro ni - Episode 3 - Banquet of the Golden Witch #02.cbz (this case is too limited, most other cases shouldn't parse out) + // new Regex( + // @"(?.*)( |_|-)(?:Episode)(?: |_)(?\d+(-\d+)?)", + // RegexOptions.IgnoreCase | RegexOptions.Compiled), }; @@ -115,6 +115,10 @@ namespace API.Parser new Regex( @"(?.*) (?\d+(?:.\d+|-\d+)?) \(\d{4}\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Noblesse - Episode 429 (74 Pages).7z + new Regex( + @"(?.*)(\s|_)(?:Episode|Ep\.?)(\s|_)(?\d+(?:.\d+|-\d+)?)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), // Akame ga KILL! ZERO (2016-2019) (Digital) (LuCaZ) new Regex( @"(?.*)\(\d", @@ -148,10 +152,7 @@ namespace API.Parser new Regex( @"^(?!Vol\.?)(?.*)( |_|-)(?.*)( |_|-)(?.*)ch\d+-?\d?", @@ -164,6 +165,14 @@ namespace API.Parser new Regex( @"^(?!Vol)(?.*)(-)\d+-?\d*", // This catches a lot of stuff ^(?!Vol)(?.*)( |_)(\d+) RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Kodoja #001 (March 2016) + new Regex( + @"(?.*)(\s|_|-)#", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Baketeriya ch01-05.zip, Akiiro Bousou Biyori - 01.jpg, Beelzebub_172_RHS.zip, Cynthia the Mission 29.rar + new Regex( + @"^(?!Vol\.?)(?.*)( |_|-)(?.*)( |_|-)(ch?)\d+", @@ -292,7 +301,7 @@ namespace API.Parser { // Historys Strongest Disciple Kenichi_v11_c90-98.zip, ...c90.5-100.5 new Regex( - @"(c|ch)(\.? ?)(?(\d+(\.\d)?)-?(\d+(\.\d)?)?)", + @"(\b|_)(c|ch)(\.?\s?)(?(\d+(\.\d)?)-?(\d+(\.\d)?)?)", RegexOptions.IgnoreCase | RegexOptions.Compiled), // [Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip new Regex( @@ -367,7 +376,7 @@ namespace API.Parser { // All Keywords, does not account for checking if contains volume/chapter identification. Parser.Parse() will handle. new Regex( - @"(?Specials?|OneShot|One\-Shot|Omake|Extra( Chapter)?|Art Collection|Side( |_)Stories|(?Specials?|OneShot|One\-Shot|Omake|Extra( Chapter)?|Art Collection|Side( |_)Stories|(?