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.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Some crazy regex for parsing chapters for poorly named files.
Joseph Milazzo6097a2acf017
diff --git a/API.Tests/ParserTest.cs b/API.Tests/ParserTest.csindex c246d1118..60a05cbef 100644--- a/API.Tests/ParserTest.cs+++ b/API.Tests/ParserTest.cs@@ -91,6 +91,7 @@ namespace API.Tests[InlineData("Tenjou_Tenge_v17_c100[MT].zip", "100")][InlineData("Shimoneta - Manmaru Hen - c001-006 (v01) [Various].zip", "1-6")][InlineData("Mujaki no Rakuen Vol12 ch76", "76")]+ [InlineData("Beelzebub_01_[Noodles].zip", "1")]public void ParseChaptersTest(string filename, string expected){Assert.Equal(expected, ParseChapter(filename));@@ -167,6 +168,14 @@ namespace API.TestsFullFilePath = 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+ });+diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.csindex 0d8c62cf5..04bc3d542 100644--- a/API/Parser/Parser.cs+++ b/API/Parser/Parser.cs@@ -115,6 +115,10 @@ namespace API.Parsernew Regex(@"(?<Series>.*) S(?<Volume>\d+) (?<Chapter>\d+)",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[]