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.

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

Joseph Milazzo17779fd8adf4
diff --git a/API.Tests/Parser/ComicParserTests.cs b/API.Tests/Parser/ComicParserTests.cs
index ccfd672bc..043c0e027 100644
--- a/API.Tests/Parser/ComicParserTests.cs
+++ b/API.Tests/Parser/ComicParserTests.cs
@@ -58,6 +58,11 @@ namespace API.Tests.Parser
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")]
[InlineData("Daredevil - v6 - 10 - (2019)", "Daredevil")]
[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)
{
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index efc15f36b..02dc6894c 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -258,19 +258,19 @@ namespace API.Parser
MatchOptions, RegexTimeout),
// Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)
new Regex(
- @"^(?<Series>.*)(?: |_)v\d+",
+ @"^(?<Series>.+?)(?: |_)v\d+",
MatchOptions, RegexTimeout),
// Amazing Man Comics chapter 25
new Regex(
- @"^(?<Series>.*)(?: |_)c(hapter) \d+",
+ @"^(?<Series>.+?)(?: |_)c(hapter) \d+",
MatchOptions, RegexTimeout),
// Amazing Man Comics issue #25
new Regex(
- @"^(?<Series>.*)(?: |_)i(ssue) #\d+",
+ @"^(?<Series>.+?)(?: |_)i(ssue) #\d+",
MatchOptions, RegexTimeout),
// Batman Wayne Family Adventures - Ep. 001 - Moving In
new Regex(
- @"^(?<Series>.+?)(\s|_|-)?(?:Ep\.?)(\s|_|-)+\d+",
+ @"^(?<Series>.+?)(\s|_|-)(?:Ep\.?)(\s|_|-)+\d+",
MatchOptions, RegexTimeout),
// Batgirl Vol.2000 #57 (December, 2004)
new Regex(
@@ -286,7 +286,7 @@ namespace API.Parser
MatchOptions, RegexTimeout),
// Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005)
new Regex(
- @"^(?<Series>.*)(?: |_)(?<Volume>\d+)",
+ @"^(?<Series>.+?)(?: |_)(?<Chapter>\d+)",
MatchOptions, RegexTimeout),
// The First Asterix Frieze (WebP by Doc MaKS)
new Regex(
@@ -887,7 +887,7 @@ namespace API.Parser
{
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)
{
- title = title.Replace(match.Value, "").Trim();
+ title = title.Replace(match.Value, string.Empty).Trim();
}
}
}
@@ -950,7 +950,7 @@ namespace API.Parser
{
if (match.Success)
{
- title = title.Replace(match.Value, "");
+ title = title.Replace(match.Value, string.Empty);
}
}
}