更新
This commit is contained in:
parent
9cf948ec9c
commit
3d58c7d497
@ -52,12 +52,24 @@ public class RawParser : ItemParser
|
||||
return (rawTitle, null);
|
||||
}
|
||||
|
||||
private void SimplifyMatches(List<string> matches)
|
||||
{
|
||||
matches.RemoveAll(match => string.IsNullOrEmpty(match.Trim()));
|
||||
matches.RemoveAll(match => Regex.Match(match.Trim(), @"\d+[Pp]$").Success);
|
||||
}
|
||||
|
||||
private List<string> GetParts(string name)
|
||||
{
|
||||
var matches = Regex.Matches(name, @"[^\[\]_【】]+").Select(match => match.Value).ToList();
|
||||
SimplifyMatches(matches);
|
||||
return matches;
|
||||
}
|
||||
|
||||
private bool TryParseRawTitle(Item item, out string rawTitle)
|
||||
{
|
||||
rawTitle = null;
|
||||
var name = item.Name();
|
||||
var matches = Regex.Matches(name, @"[^\[\]_]+").Select(match => match.Value).ToList();
|
||||
matches.RemoveAll(match => string.IsNullOrEmpty(match.Trim()));
|
||||
var matches = GetParts(name);
|
||||
|
||||
if (matches.Count == 0) return false;
|
||||
|
||||
@ -78,10 +90,11 @@ public class RawParser : ItemParser
|
||||
{
|
||||
season = null;
|
||||
var name = item.Name();
|
||||
var matches = Regex.Matches(name, @"[^\[\]_]+").Select(match => match.Value).ToArray();
|
||||
if (matches.Length == 0) return false;
|
||||
var matches = GetParts(name);
|
||||
|
||||
if (matches.Length == 1)
|
||||
if (matches.Count == 0) return false;
|
||||
|
||||
if (matches.Count == 1)
|
||||
{
|
||||
(_, season) = SplitTitleAndSeason(matches[0]);
|
||||
if (!string.IsNullOrEmpty(season)) return true;
|
||||
@ -99,8 +112,9 @@ public class RawParser : ItemParser
|
||||
{
|
||||
group = null;
|
||||
var name = item.Name();
|
||||
var matches = Regex.Matches(name, @"[^\[\]_《》【】]+").Select(match => match.Value).ToArray();
|
||||
if (matches.Length <= 1) return false;
|
||||
var matches = GetParts(name);
|
||||
|
||||
if (matches.Count <= 1) return false;
|
||||
group = matches[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user