mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fallback to Folder Parsing Issue (#694)
* Fixed a bug in the scanner where we fall back to parsing from folders for poorly named files. The code was exiting early if a chapter or volume could be parsed out. * Fixed a unit test by tweaking a regex for fallback
This commit is contained in:
parent
67ed79eaa1
commit
c813d55124
@ -297,6 +297,7 @@ namespace API.Tests.Parser
|
|||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("/manga/Btooom!/Vol.1/Chapter 1/1.cbz", "Btooom!~1~1")]
|
[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/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)
|
public void ParseFromFallbackFoldersTest(string inputFile, string expectedParseInfo)
|
||||||
{
|
{
|
||||||
const string rootDirectory = "/manga/";
|
const string rootDirectory = "/manga/";
|
||||||
@ -438,6 +439,22 @@ namespace API.Tests.Parser
|
|||||||
filepath = @"E:\Manga\Seraph of the End\cover.png";
|
filepath = @"E:\Manga\Seraph of the End\cover.png";
|
||||||
expected.Add(filepath, null);
|
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)
|
foreach (var file in expected.Keys)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ namespace API.Parser
|
|||||||
MatchOptions, RegexTimeout),
|
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)
|
// 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(
|
new Regex(
|
||||||
@"^(?!Vol\.?)(?<Series>.+?)( |_|-)(?<!-)(ch)?\d+-?\d*",
|
@"^(?!Vol\.?)(?!Chapter)(?<Series>.+?)(\s|_|-)(?<!-)(ch|chapter)?\.?\d+-?\d*",
|
||||||
MatchOptions, RegexTimeout),
|
MatchOptions, RegexTimeout),
|
||||||
// [BAA]_Darker_than_Black_c1 (This is very greedy, make sure it's close to last)
|
// [BAA]_Darker_than_Black_c1 (This is very greedy, make sure it's close to last)
|
||||||
new Regex(
|
new Regex(
|
||||||
@ -608,8 +608,6 @@ namespace API.Parser
|
|||||||
{
|
{
|
||||||
ret.Chapters = parsedChapter;
|
ret.Chapters = parsedChapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var series = ParseSeries(folder);
|
var series = ParseSeries(folder);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user