Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Special Markers (#305)

Joseph Milazzo46b60405b1e0
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(
@"(?<Special>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(
+ @"(?<Special>SP\d+)",
+ RegexOptions.IgnoreCase | RegexOptions.Compiled),
};