mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Some crazy regex for parsing chapters for poorly named files.
This commit is contained in:
parent
8683c81361
commit
6097a2acf0
@ -91,6 +91,7 @@ namespace API.Tests
|
|||||||
[InlineData("Tenjou_Tenge_v17_c100[MT].zip", "100")]
|
[InlineData("Tenjou_Tenge_v17_c100[MT].zip", "100")]
|
||||||
[InlineData("Shimoneta - Manmaru Hen - c001-006 (v01) [Various].zip", "1-6")]
|
[InlineData("Shimoneta - Manmaru Hen - c001-006 (v01) [Various].zip", "1-6")]
|
||||||
[InlineData("Mujaki no Rakuen Vol12 ch76", "76")]
|
[InlineData("Mujaki no Rakuen Vol12 ch76", "76")]
|
||||||
|
[InlineData("Beelzebub_01_[Noodles].zip", "1")]
|
||||||
public void ParseChaptersTest(string filename, string expected)
|
public void ParseChaptersTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, ParseChapter(filename));
|
Assert.Equal(expected, ParseChapter(filename));
|
||||||
@ -167,6 +168,14 @@ namespace API.Tests
|
|||||||
FullFilePath = filepath
|
FullFilePath = filepath
|
||||||
});
|
});
|
||||||
|
|
||||||
|
filepath = @"E:\Manga\Beelzebub\Beelzebub_01_[Noodles].zip";
|
||||||
|
expected.Add(filepath, new ParserInfo
|
||||||
|
{
|
||||||
|
Series = "Beelzebub", Volumes = "0",
|
||||||
|
Chapters = "1", Filename = "Beelzebub_01_[Noodles].zip", Format = MangaFormat.Archive,
|
||||||
|
FullFilePath = filepath
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +115,10 @@ namespace API.Parser
|
|||||||
new Regex(
|
new Regex(
|
||||||
@"(?<Series>.*) S(?<Volume>\d+) (?<Chapter>\d+)",
|
@"(?<Series>.*) S(?<Volume>\d+) (?<Chapter>\d+)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
// Beelzebub_01_[Noodles].zip
|
||||||
|
new Regex(
|
||||||
|
@"^((?!v|vo|vol|Volume).)*( |_)(?<Chapter>\.?\d+)( |_)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
};
|
};
|
||||||
private static readonly Regex[] MangaEditionRegex = new[]
|
private static readonly Regex[] MangaEditionRegex = new[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user