From 46b60405b1e0d3330606c0a605b3dc59e1dba17f Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Mon, 14 Jun 2021 17:35:13 -0500 Subject: [PATCH] Special Markers (#305) * Removed "Anthology" from being a special parsing keyword as series are being found where "Anthology" is in the series name. * SP# is now a way to force the file to be a special rather than pushing it into a Specials folder. --- API.Tests/Parser/MangaParserTests.cs | 2 ++ API/Parser/Parser.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs index bba6f60e8..2ec34318a 100644 --- a/API.Tests/Parser/MangaParserTests.cs +++ b/API.Tests/Parser/MangaParserTests.cs @@ -242,6 +242,8 @@ namespace API.Tests.Parser [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", false)] + [InlineData("Beastars - SP01", true)] + [InlineData("Beastars SP01", true)] public void ParseMangaSpecialTest(string input, bool expected) { Assert.Equal(expected, !string.IsNullOrEmpty(API.Parser.Parser.ParseMangaSpecial(input))); diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index 79fed5157..d453a7586 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -374,6 +374,10 @@ namespace API.Parser new Regex( @"(?Specials?|OneShot|One\-Shot|Omake|Extra( Chapter)?|Art Collection|Side( |_)Stories|Bonus)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // If SP\d+ is in the filename, we force treat it as a special regardless if volume or chapter might have been found. + new Regex( + @"(?SP\d+)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), };