From 623105ecd4cb7ae02c54dee16b0f539dc31fa843 Mon Sep 17 00:00:00 2001 From: Christoffer Green Date: Tue, 31 Aug 2021 17:57:43 +0200 Subject: [PATCH] Add support for mangapy syntax to parser (#538) Added support for MangaPy's default naming convention to parser: vol_001-1.cbz --- .gitignore | 1 + API.Tests/Parser/MangaParserTests.cs | 1 + API/Parser/Parser.cs | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 756e09822..9f28eec22 100644 --- a/.gitignore +++ b/.gitignore @@ -499,3 +499,4 @@ _temp/ _output/ API/stats/ UI/Web/dist/ +/API.Tests/Extensions/Test Data/modified on run.txt diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs index fdd8cafa3..d27f22dd9 100644 --- a/API.Tests/Parser/MangaParserTests.cs +++ b/API.Tests/Parser/MangaParserTests.cs @@ -26,6 +26,7 @@ namespace API.Tests.Parser [InlineData("Akame ga KILL! ZERO v01 (2016) (Digital) (LuCaZ).cbz", "1")] [InlineData("v001", "1")] [InlineData("Vol 1", "1")] + [InlineData("vol_356-1", "356")] // Mangapy syntax [InlineData("No Volume", "0")] [InlineData("U12 (Under 12) Vol. 0001 Ch. 0001 - Reiwa Scans (gb)", "1")] [InlineData("[Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip", "1")] diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index 6814c9bf8..b7b4ee8eb 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -83,6 +83,11 @@ namespace API.Parser @"(?.*)(\b|_|)(S(?\d+))", RegexOptions.IgnoreCase | RegexOptions.Compiled, RegexTimeout), + // vol_001-1.cbz for MangaPy default naming convention + new Regex( + @"(vol_)(?\d+)", + RegexOptions.IgnoreCase | RegexOptions.Compiled, + RegexTimeout), }; private static readonly Regex[] MangaSeriesRegex = new[]