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.

Fallback to Folder Parsing Issue (#694)

Joseph Milazzoc813d551246d
diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs
index 9cb9d560a..1576cbb07 100644
--- a/API.Tests/Parser/MangaParserTests.cs
+++ b/API.Tests/Parser/MangaParserTests.cs
@@ -297,6 +297,7 @@ namespace API.Tests.Parser
[Theory]
[InlineData("/manga/Btooom!/Vol.1/Chapter 1/1.cbz", "Btooom!~1~1")]
[InlineData("/manga/Btooom!/Vol.1 Chapter 2/1.cbz", "Btooom!~1~2")]
+ [InlineData("/manga/Monster #8/Ch. 001-016 [MangaPlus] [Digital] [amit34521]/Monster #8 Ch. 001 [MangaPlus] [Digital] [amit34521]/13.jpg", "Monster #8~0~1")]
public void ParseFromFallbackFoldersTest(string inputFile, string expectedParseInfo)
{
const string rootDirectory = "/manga/";
@@ -438,6 +439,22 @@ namespace API.Tests.Parser
filepath = @"E:\Manga\Seraph of the End\cover.png";
expected.Add(filepath, null);
+ filepath = @"E:\Manga\The Beginning After the End\Chapter 001.cbz";
+ expected.Add(filepath, new ParserInfo
+ {
+ Series = "The Beginning After the End", Volumes = "0", Edition = "",
+ Chapters = "1", Filename = "Chapter 001.cbz", Format = MangaFormat.Archive,
+ FullFilePath = filepath, IsSpecial = false
+ });
+
+ filepath = @"E:\Manga\Monster #8\Ch. 001-016 [MangaPlus] [Digital] [amit34521]\Monster #8 Ch. 001 [MangaPlus] [Digital] [amit34521]\13.jpg";
+ expected.Add(filepath, new ParserInfo
+ {
+ Series = "Monster #8", Volumes = "0", Edition = "",
+ Chapters = "1", Filename = "13.jpg", Format = MangaFormat.Archive,
+ FullFilePath = filepath, IsSpecial = false
+ });
+
foreach (var file in expected.Keys)
{
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index 51a07a835..2f8b704de 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -226,7 +226,7 @@ namespace API.Parser
MatchOptions, RegexTimeout),
// Baketeriya ch01-05.zip, Akiiro Bousou Biyori - 01.jpg, Beelzebub_172_RHS.zip, Cynthia the Mission 29.rar, A Compendium of Ghosts - 031 - The Third Story_ Part 12 (Digital) (Cobalt001)
new Regex(
- @"^(?!Vol\.?)(?<Series>.+?)( |_|-)(?<!-)(ch)?\d+-?\d*",
+ @"^(?!Vol\.?)(?!Chapter)(?<Series>.+?)(\s|_|-)(?<!-)(ch|chapter)?\.?\d+-?\d*",
MatchOptions, RegexTimeout),
// [BAA]_Darker_than_Black_c1 (This is very greedy, make sure it's close to last)
new Regex(
@@ -608,8 +608,6 @@ namespace API.Parser
{
ret.Chapters = parsedChapter;
}
-
- continue;
}
var series = ParseSeries(folder);