Potential fix for parsing Cyberpunk 2077
- Added a ComicsSeriesSpecialCasesRegex and passed any filename that contains "Cyberpunk 2077" over to it so we can parse it separately. This could be used for any other potential problem series.
This commit is contained in:
parent
569ec9bb09
commit
a14417e640
2 changed files with 30 additions and 2 deletions
|
|
@ -59,6 +59,15 @@ namespace API.Tests.Parser
|
|||
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Cyberpunk 2077 - Your Voice #01", "Cyberpunk 2077 - Your Voice")]
|
||||
[InlineData("Cyberpunk 2077 #01", "Cyberpunk 2077")]
|
||||
[InlineData("Cyberpunk 2077 - Trauma Team #04.cbz", "Cyberpunk 2077 - Trauma Team")]
|
||||
public void ParseComicSeriesSpecialCasesTest(string filename, string expected)
|
||||
{
|
||||
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("01 Spider-Man & Wolverine 01.cbr", "0")]
|
||||
[InlineData("04 - Asterix the Gladiator (1964) (Digital-Empire) (WebP by Doc MaKS)", "0")]
|
||||
|
|
@ -87,7 +96,6 @@ namespace API.Tests.Parser
|
|||
[InlineData("Batgirl Vol.2000 #57 (December, 2004)", "2000")]
|
||||
[InlineData("Batgirl V2000 #57", "2000")]
|
||||
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "0")]
|
||||
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
|
||||
public void ParseComicVolumeTest(string filename, string expected)
|
||||
{
|
||||
Assert.Equal(expected, API.Parser.Parser.ParseComicVolume(filename));
|
||||
|
|
|
|||
|
|
@ -220,6 +220,18 @@ namespace API.Parser
|
|||
MatchOptions, RegexTimeout),
|
||||
};
|
||||
|
||||
private static readonly Regex[] ComicSeriesSpecialCaseRegex = new[]
|
||||
{
|
||||
// Cyberpunk 2077 - Your Voice 01
|
||||
new Regex(
|
||||
@"^(?<Series>.+? \d.+) (?<Chapter>(?:[^#])\d+?)",
|
||||
MatchOptions, RegexTimeout),
|
||||
// Cyberpunk 2077 #01
|
||||
new Regex(
|
||||
@"^(?<Series>.+? \d.+) #(?<Chapter>\d.+?)",
|
||||
MatchOptions, RegexTimeout),
|
||||
};
|
||||
|
||||
private static readonly Regex[] ComicSeriesRegex = new[]
|
||||
{
|
||||
// Invincible Vol 01 Family matters (2005) (Digital)
|
||||
|
|
@ -714,7 +726,15 @@ namespace API.Parser
|
|||
}
|
||||
public static string ParseComicSeries(string filename)
|
||||
{
|
||||
foreach (var regex in ComicSeriesRegex)
|
||||
Regex[] ComicCase;
|
||||
if (filename.Contains("Cyberpunk 2077"))
|
||||
{
|
||||
ComicCase = ComicSeriesSpecialCaseRegex;
|
||||
} else
|
||||
{
|
||||
ComicCase = ComicSeriesRegex;
|
||||
}
|
||||
foreach (var regex in ComicCase)
|
||||
{
|
||||
var matches = regex.Matches(filename);
|
||||
foreach (Match match in matches)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue