mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-10 17:14:14 -04:00
* Refactored invite user flow to separate error handling on create user flow and email flow. This should help users that have unique situations. * Switch to using files to check LastWriteTime. Debug code in for Robbie to test on rclone * Updated Parser namespace. Changed the LastWriteTime to check all files and folders.
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using API.Entities;
|
|
using API.Entities.Enums;
|
|
using API.Parser;
|
|
using API.Services.Tasks.Scanner;
|
|
|
|
namespace API.Helpers;
|
|
|
|
public static class ParserInfoHelpers
|
|
{
|
|
/// <summary>
|
|
/// Checks each parser info to see if there is a name match and if so, checks if the format matches the Series object.
|
|
/// This accounts for if the Series has an Unknown type and if so, considers it matching.
|
|
/// </summary>
|
|
/// <param name="series"></param>
|
|
/// <param name="parsedSeries"></param>
|
|
/// <returns></returns>
|
|
public static bool SeriesHasMatchingParserInfoFormat(Series series,
|
|
Dictionary<ParsedSeries, IList<ParserInfo>> parsedSeries)
|
|
{
|
|
var format = MangaFormat.Unknown;
|
|
foreach (var pSeries in parsedSeries.Keys)
|
|
{
|
|
var name = pSeries.Name;
|
|
var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
|
|
|
|
//if (series.NameInParserInfo(pSeries.))
|
|
if (normalizedName == series.NormalizedName ||
|
|
normalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name) ||
|
|
name == series.Name || name == series.LocalizedName ||
|
|
name == series.OriginalName ||
|
|
normalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName))
|
|
{
|
|
format = pSeries.Format;
|
|
if (format == series.Format)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (series.Format == MangaFormat.Unknown && format != MangaFormat.Unknown)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return format == series.Format;
|
|
}
|
|
}
|