Some testing on Generic library
This commit is contained in:
parent
5423526484
commit
fad70432fb
6 changed files with 26 additions and 6 deletions
|
@ -17,7 +17,13 @@ public class GenericLibraryParser(IDirectoryService directoryService) : DefaultP
|
|||
public override ParserInfo? Parse(string filePath, string rootPath, string libraryRoot, LibraryType type,
|
||||
ComicInfo? comicInfo = null, IEnumerable<string>? extraRegex = null)
|
||||
{
|
||||
if (extraRegex == null) return null;
|
||||
//if (extraRegex == null) return null;
|
||||
|
||||
// It can be very difficult for the user to supply all the regex needed to properly parse, we might need to let them override (but not sure how this will work)
|
||||
extraRegex = new List<string>()
|
||||
{
|
||||
@"(?<Series>.*)(\b|_)v(?<Volume>\d+-?\d+)( |_)"
|
||||
};
|
||||
|
||||
// The idea is this is passed in as a default param. Only Generic will use it
|
||||
var fileName = directoryService.FileSystem.Path.GetFileNameWithoutExtension(filePath);
|
||||
|
@ -36,7 +42,7 @@ public class GenericLibraryParser(IDirectoryService directoryService) : DefaultP
|
|||
|
||||
foreach (var regex in extraRegex)
|
||||
{
|
||||
var matches = new Regex(regex, RegexOptions.IgnoreCase).Matches(fileName);
|
||||
var matches = new Regex(regex, Parser.MatchOptions, Parser.RegexTimeout).Matches(fileName);
|
||||
foreach (var group in matches.Select(match => match.Groups))
|
||||
{
|
||||
foreach (var matchKey in group.Keys)
|
||||
|
@ -50,6 +56,9 @@ public class GenericLibraryParser(IDirectoryService directoryService) : DefaultP
|
|||
case "Chapter":
|
||||
info.Chapters = SetIfNotDefault(matchValue, info.Chapters);
|
||||
break;
|
||||
case "Volume":
|
||||
info.Volumes = SetIfNotDefault(matchValue, info.Volumes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public static class Parser
|
|||
public const string SupportedExtensions =
|
||||
ArchiveFileExtensions + "|" + ImageFileExtensions + "|" + BookFileExtensions;
|
||||
|
||||
private const RegexOptions MatchOptions =
|
||||
public const RegexOptions MatchOptions =
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant;
|
||||
|
||||
private static readonly ImmutableArray<string> FormatTagSpecialKeywords = ImmutableArray.Create(
|
||||
|
@ -1149,7 +1149,7 @@ public static class Parser
|
|||
|
||||
public static string? ExtractFilename(string fileUrl)
|
||||
{
|
||||
var matches = Parser.CssImageUrlRegex.Matches(fileUrl);
|
||||
var matches = CssImageUrlRegex.Matches(fileUrl);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
if (!match.Success) continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue