Add comics-downloader parser (#611)

* Add comics-downloader parser

The utility comics-downloader can be used to download comics
and produces files of the type "seriesname-chapternumberpadded".
This adds support for that format.

For more info https://github.com/Girbons/comics-downloader

* Adjusted the test cases and added .+? to consume less characters.

Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
Christoffer Green 2021-10-03 14:42:40 +02:00 committed by GitHub
parent 8d2bd45073
commit 63d7439938
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -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")]

View File

@ -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[]