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.

Add comics-downloader parser (#611)

Christoffer Green63d7439938bf
diff --git a/API.Tests/Parser/ComicParserTests.cs b/API.Tests/Parser/ComicParserTests.cs
index 8d25661ff..d1d8209e7 100644
--- a/API.Tests/Parser/ComicParserTests.cs
+++ b/API.Tests/Parser/ComicParserTests.cs
@@ -28,6 +28,7 @@ namespace API.Tests.Parser
[InlineData("Invincible 033.5 - Marvel Team-Up 14 (2006) (digital) (Minutemen-Slayer)", "Invincible")]
[InlineData("Batman Wayne Family Adventures - Ep. 001 - Moving In", "Batman Wayne Family Adventures")]
[InlineData("Saga 001 (2012) (Digital) (Empire-Zone).cbr", "Saga")]
+ [InlineData("spawn-123", "spawn")]
[InlineData("Batman Beyond 04 (of 6) (1999)", "Batman Beyond")]
public void ParseComicSeriesTest(string filename, string expected)
{
@@ -52,6 +53,7 @@ namespace API.Tests.Parser
[InlineData("Amazing Man Comics chapter 25", "0")]
[InlineData("Invincible 033.5 - Marvel Team-Up 14 (2006) (digital) (Minutemen-Slayer)", "0")]
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
+ [InlineData("spawn-123", "0")]
public void ParseComicVolumeTest(string filename, string expected)
{
Assert.Equal(expected, API.Parser.Parser.ParseComicVolume(filename));
@@ -77,6 +79,7 @@ namespace API.Tests.Parser
[InlineData("Invincible 033.5 - Marvel Team-Up 14 (2006) (digital) (Minutemen-Slayer)", "33.5")]
[InlineData("Batman Wayne Family Adventures - Ep. 014 - Moving In", "14")]
[InlineData("Saga 001 (2012) (Digital) (Empire-Zone)", "1")]
+ [InlineData("spawn-123", "123")]
[InlineData("Batman Beyond 04 (of 6) (1999)", "4")]
[InlineData("Invincible 052 (c2c) (2008) (Minutemen-TheCouple)", "52")]
[InlineData("Y - The Last Man #001", "1")]
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index d29dc328a..84a6bcb43 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -327,6 +327,11 @@ namespace API.Parser
@"^(?<Series>.*)(?: |_)(?!\(\d{4}|\d{4}-\d{2}\))\(",
MatchOptions,
RegexTimeout),
+ // spawn-123 (from https://github.com/Girbons/comics-downloader)
+ new Regex(
+ @"^(?<Series>.+?)-(?<Chapter>\d+)",
+ MatchOptions,
+ RegexTimeout),
// MUST BE LAST: Batman & Daredevil - King of New York
new Regex(
@"^(?<Series>.*)",
@@ -423,6 +428,11 @@ namespace API.Parser
@"^(?!Vol)(?<Series>.+?)( |_)i(ssue)( |_) #(?<Chapter>\d*)",
MatchOptions,
RegexTimeout),
+ // spawn-123 (from https://github.com/Girbons/comics-downloader )
+ new Regex(
+ @"^(?<Series>.+?)-(?<Chapter>\d+)",
+ MatchOptions,
+ RegexTimeout),
};
private static readonly Regex[] ReleaseGroupRegex = new[]