diff --git a/API.Benchmark/ParseScannedFilesBenchmarks.cs b/API.Benchmark/ParseScannedFilesBenchmarks.cs
index 184f45d8c..d3fd19a4e 100644
--- a/API.Benchmark/ParseScannedFilesBenchmarks.cs
+++ b/API.Benchmark/ParseScannedFilesBenchmarks.cs
@@ -1,7 +1,9 @@
using System;
using System.IO;
+using API.Data;
using API.Entities.Enums;
using API.Interfaces.Services;
+using API.Parser;
using API.Services;
using API.Services.Tasks.Scanner;
using BenchmarkDotNet.Attributes;
@@ -14,7 +16,7 @@ namespace API.Benchmark
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
- [SimpleJob(launchCount: 1, warmupCount: 3, targetCount: 5, invocationCount: 100, id: "Test"), ShortRunJob]
+ //[SimpleJob(launchCount: 1, warmupCount: 3, targetCount: 5, invocationCount: 100, id: "Test"), ShortRunJob]
public class ParseScannedFilesBenchmarks
{
private readonly ParseScannedFiles _parseScannedFiles;
@@ -27,13 +29,37 @@ namespace API.Benchmark
_parseScannedFiles = new ParseScannedFiles(bookService, _logger);
}
+ // [Benchmark]
+ // public void Test()
+ // {
+ // var libraryPath = Path.Join(Directory.GetCurrentDirectory(),
+ // "../../../Services/Test Data/ScannerService/Manga");
+ // var parsedSeries = _parseScannedFiles.ScanLibrariesForSeries(LibraryType.Manga, new string[] {libraryPath},
+ // out var totalFiles, out var scanElapsedTime);
+ // }
+
+ ///
+ /// Generate a list of Series and another list with
+ ///
[Benchmark]
- public void Test()
+ public void MergeName()
{
var libraryPath = Path.Join(Directory.GetCurrentDirectory(),
"../../../Services/Test Data/ScannerService/Manga");
+ var p1 = new ParserInfo()
+ {
+ Chapters = "0",
+ Edition = "",
+ Format = MangaFormat.Archive,
+ FullFilePath = Path.Join(libraryPath, "A Town Where You Live", "A_Town_Where_You_Live_v01.zip"),
+ IsSpecial = false,
+ Series = "A Town Where You Live",
+ Title = "A Town Where You Live",
+ Volumes = "1"
+ };
var parsedSeries = _parseScannedFiles.ScanLibrariesForSeries(LibraryType.Manga, new string[] {libraryPath},
out var totalFiles, out var scanElapsedTime);
+ _parseScannedFiles.MergeName(p1);
}
}
}
diff --git a/API.Benchmark/Program.cs b/API.Benchmark/Program.cs
index 0b35a82f0..b308a07b7 100644
--- a/API.Benchmark/Program.cs
+++ b/API.Benchmark/Program.cs
@@ -12,8 +12,8 @@ namespace API.Benchmark
{
static void Main(string[] args)
{
- //BenchmarkRunner.Run();
- BenchmarkRunner.Run();
+ BenchmarkRunner.Run();
+ //BenchmarkRunner.Run();
}
}
}
diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs
index 89f7e733e..720dffd71 100644
--- a/API.Tests/Parser/MangaParserTests.cs
+++ b/API.Tests/Parser/MangaParserTests.cs
@@ -159,6 +159,7 @@ namespace API.Tests.Parser
[InlineData("Hentai Ouji to Warawanai Neko. - Vol. 06 Ch. 034.5", "Hentai Ouji to Warawanai Neko.")]
[InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03 Ch. 023.5 - Volume 3 Extras.cbz", "The 100 Girlfriends Who Really, Really, Really, Really, Really Love You")]
[InlineData("Kimi no Koto ga Daidaidaidaidaisuki na 100-nin no Kanojo Chapter 1-10", "Kimi no Koto ga Daidaidaidaidaisuki na 100-nin no Kanojo")]
+ [InlineData("A Compendium of Ghosts - 031 - The Third Story_ Part 12 (Digital) (Cobalt001)", "A Compendium of Ghosts")]
public void ParseSeriesTest(string filename, string expected)
{
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index 702f4aabf..aa354ce7c 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -245,9 +245,9 @@ namespace API.Parser
@"(?.*)(\s|_|-)#",
RegexOptions.IgnoreCase | RegexOptions.Compiled,
RegexTimeout),
- // Baketeriya ch01-05.zip, Akiiro Bousou Biyori - 01.jpg, Beelzebub_172_RHS.zip, Cynthia the Mission 29.rar
+ // 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(
- @"^(?!Vol\.?)(?.*)( |_|-)(?.+?)( |_|-)(?>();
}
+ ///
+ /// Gets the list of parserInfos given a Series. If the series does not exist within, return empty list.
+ ///
+ ///
+ ///
+ ///
public static IList GetInfosByName(Dictionary> parsedSeries, Series series)
{
var existingKey = parsedSeries.Keys.FirstOrDefault(ps =>
ps.Format == series.Format && ps.NormalizedName == Parser.Parser.Normalize(series.OriginalName));
- existingKey ??= new ParsedSeries()
- {
- Format = series.Format,
- Name = series.OriginalName,
- NormalizedName = Parser.Parser.Normalize(series.OriginalName)
- };
- return parsedSeries[existingKey];
+ return existingKey != null ? parsedSeries[existingKey] : new List();
}
///