Fixed some comic parsing bugs based on user report (#758) (#761)

This commit is contained in:
Joseph Milazzo 2021-11-16 08:07:42 -06:00 committed by GitHub
parent 31fa44859c
commit 17779fd8ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -58,6 +58,11 @@ namespace API.Tests.Parser
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")] [InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")]
[InlineData("Daredevil - v6 - 10 - (2019)", "Daredevil")] [InlineData("Daredevil - v6 - 10 - (2019)", "Daredevil")]
[InlineData("Batman - The Man Who Laughs #1 (2005)", "Batman - The Man Who Laughs")] [InlineData("Batman - The Man Who Laughs #1 (2005)", "Batman - The Man Who Laughs")]
[InlineData("Demon 012 (Sep 1973) c2c", "Demon")]
[InlineData("Dragon Age - Until We Sleep 01 (of 03)", "Dragon Age - Until We Sleep")]
[InlineData("Green Lantern v2 017 - The Spy-Eye that doomed Green Lantern v2", "Green Lantern")]
[InlineData("Green Lantern - Circle of Fire Special - Adam Strange (2000)", "Green Lantern - Circle of Fire - Adam Strange")]
[InlineData("Identity Crisis Extra - Rags Morales Sketches (2005)", "Identity Crisis - Rags Morales Sketches")]
public void ParseComicSeriesTest(string filename, string expected) public void ParseComicSeriesTest(string filename, string expected)
{ {
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename)); Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));

View File

@ -258,19 +258,19 @@ namespace API.Parser
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus) // Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)
new Regex( new Regex(
@"^(?<Series>.*)(?: |_)v\d+", @"^(?<Series>.+?)(?: |_)v\d+",
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Amazing Man Comics chapter 25 // Amazing Man Comics chapter 25
new Regex( new Regex(
@"^(?<Series>.*)(?: |_)c(hapter) \d+", @"^(?<Series>.+?)(?: |_)c(hapter) \d+",
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Amazing Man Comics issue #25 // Amazing Man Comics issue #25
new Regex( new Regex(
@"^(?<Series>.*)(?: |_)i(ssue) #\d+", @"^(?<Series>.+?)(?: |_)i(ssue) #\d+",
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Batman Wayne Family Adventures - Ep. 001 - Moving In // Batman Wayne Family Adventures - Ep. 001 - Moving In
new Regex( new Regex(
@"^(?<Series>.+?)(\s|_|-)?(?:Ep\.?)(\s|_|-)+\d+", @"^(?<Series>.+?)(\s|_|-)(?:Ep\.?)(\s|_|-)+\d+",
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Batgirl Vol.2000 #57 (December, 2004) // Batgirl Vol.2000 #57 (December, 2004)
new Regex( new Regex(
@ -286,7 +286,7 @@ namespace API.Parser
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005) // Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005)
new Regex( new Regex(
@"^(?<Series>.*)(?: |_)(?<Volume>\d+)", @"^(?<Series>.+?)(?: |_)(?<Chapter>\d+)",
MatchOptions, RegexTimeout), MatchOptions, RegexTimeout),
// The First Asterix Frieze (WebP by Doc MaKS) // The First Asterix Frieze (WebP by Doc MaKS)
new Regex( new Regex(
@ -887,7 +887,7 @@ namespace API.Parser
{ {
if (match.Success) if (match.Success)
{ {
title = title.Replace(match.Value, "").Trim(); title = title.Replace(match.Value, string.Empty).Trim();
} }
} }
} }
@ -904,7 +904,7 @@ namespace API.Parser
{ {
if (match.Success) if (match.Success)
{ {
title = title.Replace(match.Value, "").Trim(); title = title.Replace(match.Value, string.Empty).Trim();
} }
} }
} }
@ -950,7 +950,7 @@ namespace API.Parser
{ {
if (match.Success) if (match.Success)
{ {
title = title.Replace(match.Value, ""); title = title.Replace(match.Value, string.Empty);
} }
} }
} }