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:
Joseph Milazzo 2021-09-12 09:48:21 -07:00 committed by GitHub
parent dd6dec46c1
commit a9ea03469f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 13 deletions

View file

@ -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>