From beca4a4de53c9b967f77e336b48ac680979065b5 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Tue, 11 May 2021 15:57:11 -0500 Subject: [PATCH] Bugfix/parser (#214) * Fixed #211 * Fixed #213. Somehow a + 1 got removed --- API.Tests/Parser/MangaParserTests.cs | 1 + API/Controllers/ReaderController.cs | 2 +- API/Parser/Parser.cs | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs index 39437a2a1..e1b143272 100644 --- a/API.Tests/Parser/MangaParserTests.cs +++ b/API.Tests/Parser/MangaParserTests.cs @@ -197,6 +197,7 @@ namespace API.Tests.Parser [InlineData("Kiss x Sis - Ch.00 - Let's Start from 0.cbz", "0")] [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "2")] [InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "3")] + [InlineData("Tomogui Kyoushitsu - Chapter 006 Game 005 - Fingernails On Right Hand (Part 002).cbz", "6")] public void ParseChaptersTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseChapter(filename)); diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs index 383021408..8e8c8c27e 100644 --- a/API/Controllers/ReaderController.cs +++ b/API/Controllers/ReaderController.cs @@ -279,7 +279,7 @@ namespace API.Controllers if (chapterId > 0) return Ok(chapterId); } - if (volume.Number == currentVolume.Number) + if (volume.Number == currentVolume.Number + 1) { return Ok(volume.Chapters.FirstOrDefault()?.Id); } diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index 71e01785c..9612fb7cd 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -302,7 +302,10 @@ namespace API.Parser new Regex( @"^(?.*)(?: |_)#(?\d+)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - + // Green Worldz - Chapter 027 + new Regex( + @"^(?!Vol)(?.*)\s?(?\d+(?:.\d+|-\d+)?)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), // Hinowa ga CRUSH! 018 (2019) (Digital) (LuCaZ).cbz, Hinowa ga CRUSH! 018.5 (2019) (Digital) (LuCaZ).cbz new Regex( @"^(?!Vol)(?.*) (?\d+(?:.\d+|-\d+)?)(?: \(\d{4}\))?(\b|_|-)",