Bugfix/scanner issue (#576)
* Refactored the scanner to hopefully fix a hard to reproduce KeyNotFoundException from GetInfosByName. * Added parsing support for "A Compendium of Ghosts - 031 - The Third Story_ Part 12 (Digital) (Cobalt001)"
This commit is contained in:
parent
dd6dec46c1
commit
a9ea03469f
5 changed files with 40 additions and 13 deletions
|
|
@ -245,9 +245,9 @@ namespace API.Parser
|
|||
@"(?<Series>.*)(\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\.?)(?<Series>.*)( |_|-)(?<!-)(ch)?\d+-?\d*",
|
||||
@"^(?!Vol\.?)(?<Series>.+?)( |_|-)(?<!-)(ch)?\d+-?\d*",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled,
|
||||
RegexTimeout),
|
||||
// [BAA]_Darker_than_Black_c1 (This is very greedy, make sure it's close to last)
|
||||
|
|
|
|||
|
|
@ -39,18 +39,18 @@ namespace API.Services.Tasks.Scanner
|
|||
_scannedSeries = new ConcurrentDictionary<ParsedSeries, List<ParserInfo>>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of parserInfos given a Series. If the series does not exist within, return empty list.
|
||||
/// </summary>
|
||||
/// <param name="parsedSeries"></param>
|
||||
/// <param name="series"></param>
|
||||
/// <returns></returns>
|
||||
public static IList<ParserInfo> GetInfosByName(Dictionary<ParsedSeries, List<ParserInfo>> 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<ParserInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue