Implemented a parallelized, rough, scanning loop which parses out information and leaves us with an immutable dictionary mapping series to parsed infos for each file.

Added some Entities to help translate this into DB.
This commit is contained in:
Joseph Milazzo 2020-12-29 10:47:10 -06:00
parent 49b4ee0022
commit 0a49b07570
7 changed files with 220 additions and 7 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace API.Parser
@ -47,10 +48,20 @@ namespace API.Parser
@"(?<Series>.*)(\b|_)(v|vo|c)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// Akame ga KILL! ZERO (2016-2019) (Digital) (LuCaZ)
new Regex(
@"(?<Series>.*)\(\d",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// [BAA]_Darker_than_Black_c1 (This is very greedy, make sure it's always last)
new Regex(
@"(?<Series>.*)(\b|_)(c)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// Darker Than Black (This takes anything, we have to account for perfectly named folders)
new Regex(
@"(?<Series>.*)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
};
@ -72,6 +83,18 @@ namespace API.Parser
@"(c|ch)(\.? ?)(?<Chapter>\d+-?\d*)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
};
public static ParserInfo Parse(string filePath)
{
return new ParserInfo()
{
Chapters = ParseChapter(filePath),
Series = ParseSeries(filePath),
Volumes = ParseVolume(filePath),
File = filePath
};
}
public static string ParseSeries(string filename)
{