Implemented ability to generate Series summary from ComicInfo.xml (if present)

This commit is contained in:
Joseph Milazzo 2021-02-17 16:41:42 -06:00
parent 5be01b529b
commit 265f7dcc8c
4 changed files with 62 additions and 3 deletions

View file

@ -10,8 +10,10 @@ namespace API.Parser
{
public static readonly string MangaFileExtensions = @"\.cbz|\.zip"; // |\.rar|\.cbr
public static readonly string ImageFileExtensions = @"\.png|\.jpeg|\.jpg|\.gif";
private static readonly string XmlRegexExtensions = @"\.xml";
private static readonly Regex ImageRegex = new Regex(ImageFileExtensions, RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex MangaFileRegex = new Regex(MangaFileExtensions, RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex XmlRegex = new Regex(XmlRegexExtensions, RegexOptions.IgnoreCase | RegexOptions.Compiled);
//?: is a non-capturing group in C#, else anything in () will be a group
private static readonly Regex[] MangaVolumeRegex = new[]
@ -406,6 +408,12 @@ namespace API.Parser
return ImageRegex.IsMatch(fileInfo.Extension);
}
public static bool IsXml(string filePath)
{
var fileInfo = new FileInfo(filePath);
return XmlRegex.IsMatch(fileInfo.Extension);
}
public static float MinimumNumberFromRange(string range)
{
var tokens = range.Split("-");
@ -416,5 +424,7 @@ namespace API.Parser
{
return name.ToLower().Replace("-", "").Replace(" ", "");
}
}
}