diff --git a/API.Tests/ParserTest.cs b/API.Tests/ParserTest.cs index 145bca0fa..3534e75f8 100644 --- a/API.Tests/ParserTest.cs +++ b/API.Tests/ParserTest.cs @@ -60,6 +60,7 @@ namespace API.Tests [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "20")] [InlineData("Gantz.V26.cbz", "26")] [InlineData("NEEDLESS_Vol.4_-Simeon_6_v2[SugoiSugoi].rar", "4")] + [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "1")] public void ParseVolumeTest(string filename, string expected) { Assert.Equal(expected, ParseVolume(filename)); @@ -121,12 +122,16 @@ namespace API.Tests [InlineData("[SugoiSugoi]_NEEDLESS_Vol.2_-_Disk_The_Informant_5_[ENG].rar", "NEEDLESS")] [InlineData("Fullmetal Alchemist chapters 101-108.cbz", "Fullmetal Alchemist")] [InlineData("To Love Ru v09 Uncensored (Ch.071-079).cbz", "To Love Ru")] - [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "One Piece")] + [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "One Piece - Digital Colored Comics")] //[InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Extra Chapter", "Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U")] [InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Chapter 01", "Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U")] [InlineData("Vol03_ch15-22.rar", "")] [InlineData("Love Hina - Special.cbz", "")] // This has to be a fallback case [InlineData("Ani-Hina Art Collection.cbz", "")] // This has to be a fallback case + [InlineData("Magi - Ch.252-005.cbz", "Magi")] + [InlineData("Umineko no Naku Koro ni - Episode 1 - Legend of the Golden Witch #1", "Umineko no Naku Koro ni")] + [InlineData("Kimetsu no Yaiba - Digital Colored Comics c162 Three Victorious Stars.cbz", "Kimetsu no Yaiba - Digital Colored Comics")] + [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "Amaenaideyo MS")] public void ParseSeriesTest(string filename, string expected) { Assert.Equal(expected, ParseSeries(filename)); @@ -179,6 +184,13 @@ namespace API.Tests [InlineData("Corpse Party -The Anthology- Sachikos game of love Hysteric Birthday 2U Extra Chapter.rar", "0")] [InlineData("Beelzebub_153b_RHS.zip", "153.5")] [InlineData("Beelzebub_150-153b_RHS.zip", "150-153.5")] + [InlineData("Transferred to another world magical swordsman v1.1", "1")] + [InlineData("Transferred to another world magical swordsman v1.2", "2")] + [InlineData("Kiss x Sis - Ch.15 - The Angst of a 15 Year Old Boy.cbz", "15")] + [InlineData("Kiss x Sis - Ch.12 - 1 , 2 , 3P!.cbz", "12")] + [InlineData("Umineko no Naku Koro ni - Episode 1 - Legend of the Golden Witch #1", "1")] + [InlineData("Kiss x Sis - Ch.00 - Let's Start from 0.cbz", "0")] + [InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "2")] public void ParseChaptersTest(string filename, string expected) { Assert.Equal(expected, ParseChapter(filename)); @@ -234,7 +246,7 @@ namespace API.Tests [InlineData("Wotakoi - Love is Hard for Otaku Omnibus v01 (2018) (Digital) (danke-Empire)", "Omnibus")] [InlineData("To Love Ru v01 Uncensored (Ch.001-007)", "Uncensored")] [InlineData("Chobits Omnibus Edition v01 [Dark Horse]", "Omnibus Edition")] - [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "Digital Colored Comics")] + [InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "")] [InlineData("AKIRA - c003 (v01) [Full Color] [Darkhorse].cbz", "Full Color")] public void ParseEditionTest(string input, string expected) { diff --git a/API/Data/LibraryRepository.cs b/API/Data/LibraryRepository.cs index 9b0e23e56..707e7c62c 100644 --- a/API/Data/LibraryRepository.cs +++ b/API/Data/LibraryRepository.cs @@ -41,6 +41,7 @@ namespace API.Data .OrderBy(l => l.Name) .ProjectTo(_mapper.ConfigurationProvider) .AsNoTracking() + .AsSingleQuery() .ToListAsync(); } diff --git a/API/Data/SeriesRepository.cs b/API/Data/SeriesRepository.cs index 652316bf2..f111911c3 100644 --- a/API/Data/SeriesRepository.cs +++ b/API/Data/SeriesRepository.cs @@ -315,14 +315,13 @@ namespace API.Data /// public async Task> GetInProgress(int userId, int libraryId, int limit) { - - var seriesWithProgress = _context.Series + var series = await _context.Series .Join(_context.AppUserProgresses, s => s.Id, progress => progress.SeriesId, (s, progress) => new { Series = s, PagesRead = _context.AppUserProgresses.Where(s1 => s1.SeriesId == s.Id).Sum(s1 => s1.PagesRead), progress.AppUserId, - progress.LastModified + LastModified = _context.AppUserProgresses.Where(p => p.Id == progress.Id).Max(p => p.LastModified) }) .Where(s => s.AppUserId == userId && s.PagesRead > 0 @@ -330,14 +329,11 @@ namespace API.Data && (libraryId <= 0 || s.Series.LibraryId == libraryId)) .OrderByDescending(s => s.LastModified) .Take(limit) - .Select(s => s.Series.Id); - - - var series = await _context.Series - .Where(s => seriesWithProgress.Contains(s.Id)) + .Select(s => s.Series) .ProjectTo(_mapper.ConfigurationProvider) - .AsNoTracking() - .ToListAsync(); + .AsNoTracking() + .ToListAsync(); + return series.DistinctBy(s => s.Name); } } diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs index cb00043dd..dc2e701e2 100644 --- a/API/Parser/Parser.cs +++ b/API/Parser/Parser.cs @@ -68,10 +68,7 @@ namespace API.Parser new Regex( @"(?.*) (\b|_|-)(vol)\.?", RegexOptions.IgnoreCase | RegexOptions.Compiled), - // Historys Strongest Disciple Kenichi_v11_c90-98.zip, Killing Bites Vol. 0001 Ch. 0001 - Galactica Scanlations (gb) - new Regex( - @"(?.*) (\b|_|-)v", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Kedouin Makoto - Corpse Party Musume, Chapter 19 [Dametrans].zip new Regex( @"(?.*)(?:, Chapter )(?\d+)", @@ -84,6 +81,10 @@ namespace API.Parser new Regex( @"(?.*)(\bc\d+\b)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Historys Strongest Disciple Kenichi_v11_c90-98.zip, Killing Bites Vol. 0001 Ch. 0001 - Galactica Scanlations (gb) + new Regex( + @"(?.*) (\b|_|-)v", + RegexOptions.IgnoreCase | RegexOptions.Compiled), //Ichinensei_ni_Nacchattara_v01_ch01_[Taruby]_v1.1.zip must be before [Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1.zip // due to duplicate version identifiers in file. new Regex( @@ -113,6 +114,10 @@ namespace API.Parser new Regex( @"(?.*)(_)(v|vo|c|volume)( |_)\d+", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // [Hidoi]_Amaenaideyo_MS_vol01_chp02.rar + new Regex( + @"(?.*)( |_)(vol\d+)?( |_)(?:Chp\.? ?\d+)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), // Mahoutsukai to Deshi no Futekisetsu na Kankei Chp. 1 new Regex( @"(?.*)( |_)(?:Chp.? ?\d+)", @@ -129,14 +134,22 @@ namespace API.Parser new Regex( @"^(?!vol)(?.*)( |_)(chapters( |_)?)\d+-?\d*", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Umineko no Naku Koro ni - Episode 1 - Legend of the Golden Witch #1 + new Regex( + @"^(?!Vol\.?)(?.*)( |_|-)(?.*)( |_|-)(?.*)( |_|-)(?.*)ch\d+-?\d?", RegexOptions.IgnoreCase | RegexOptions.Compiled), + // Magi - Ch.252-005.cbz + new Regex( + @"(?.*)( ?- ?)Ch\.\d+-?\d*", + RegexOptions.IgnoreCase | RegexOptions.Compiled), // [BAA]_Darker_than_Black_Omake-1.zip new Regex( @"^(?!Vol)(?.*)(-)\d+-?\d*", // This catches a lot of stuff ^(?!Vol)(?.*)( |_)(\d+) @@ -292,6 +305,10 @@ namespace API.Parser new Regex( @"Chapter(?\d+(-\d+)?)", //(?:.\d+|-\d+)? RegexOptions.IgnoreCase | RegexOptions.Compiled), + // [Hidoi]_Amaenaideyo_MS_vol01_chp02.rar + new Regex( + @"(?.*)( |_)(vol\d+)?( |_)Chp\.? ?(?\d+)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), }; private static readonly Regex[] MangaEditionRegex = { @@ -307,10 +324,6 @@ namespace API.Parser new Regex( @"(\b|_)(?Uncensored)(\b|_)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - // [dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz - new Regex( - @"(\b|_)(?Digital(?: |_)Colored(?: |_)Comics)(\b|_)?", - RegexOptions.IgnoreCase | RegexOptions.Compiled), // AKIRA - c003 (v01) [Full Color] [Darkhorse].cbz new Regex( @"(\b|_)(?Full(?: |_)Color)(\b|_)?",