Implemented the ability to read format tag and force special status. (#1284)

This commit is contained in:
Joseph Milazzo 2022-05-25 12:05:16 -05:00 committed by GitHub
parent a0e1ba8d67
commit 1a128a3af4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@ -512,6 +513,11 @@ namespace API.Parser
MatchOptions, RegexTimeout
);
private static readonly ImmutableArray<string> FormatTagSpecialKeyowrds = ImmutableArray.Create(
"Special", "Reference", "Director's Cut", "Box Set", "Box-Set", "Annual", "Anthology", "Epilogue",
"One Shot", "One-Shot", "Prologue", "TPB", "Trade Paper Back", "Omnibus", "Compendium", "Absolute", "Graphic Novel",
"GN", "FCBD");
public static MangaFormat ParseFormat(string filePath)
{
if (IsArchive(filePath)) return MangaFormat.Archive;
@ -1034,5 +1040,15 @@ namespace API.Parser
{
return path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
}
/// <summary>
/// Checks against a set of strings to validate if a ComicInfo.Format should receive special treatment
/// </summary>
/// <param name="comicInfoFormat"></param>
/// <returns></returns>
public static bool HasComicInfoSpecial(string comicInfoFormat)
{
return FormatTagSpecialKeyowrds.Contains(comicInfoFormat);
}
}
}