mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-22 07:43:01 +00:00
Fix overzealous regex
This commit is contained in:
parent
f9f08cfea2
commit
a1e6a2c530
1 changed files with 3 additions and 4 deletions
|
@ -8,7 +8,6 @@ using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Instrumentation;
|
using NzbDrone.Common.Instrumentation;
|
||||||
using NzbDrone.Core.Languages;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -30,13 +29,13 @@ namespace NzbDrone.Core.Parser
|
||||||
new RegexReplace(@"^\[(?<subgroup>[^\]]*?(?:LoliHouse|ZERO|Lilith-Raws)[^\]]*?)\](?<title>[^\[\]]+?)(?: - (?<episode>[0-9-]+)\s*|\[第?(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?\])\[", "[${subgroup}][${title}][${episode}][", RegexOptions.Compiled),
|
new RegexReplace(@"^\[(?<subgroup>[^\]]*?(?:LoliHouse|ZERO|Lilith-Raws)[^\]]*?)\](?<title>[^\[\]]+?)(?: - (?<episode>[0-9-]+)\s*|\[第?(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?\])\[", "[${subgroup}][${title}][${episode}][", RegexOptions.Compiled),
|
||||||
|
|
||||||
// Most Chinese anime releases contain additional brackets/separators for chinese and non-chinese titles, remove junk and replace with normal anime pattern
|
// Most Chinese anime releases contain additional brackets/separators for chinese and non-chinese titles, remove junk and replace with normal anime pattern
|
||||||
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\s?★[^\[ -]+\s?)?\[?(?:(?<chinesetitle>[^\]]*?[\u4E00-\u9FCC][^\]]*?)(?:\]\[|\s*[_/·]\s*))?(?<title>[^\]]+?)\]?(?:\[\d{4}\])?\[第?(?<episode>[0-9]+(?:-[0-9]+)?)(?:话|集)?(?:END|完)?\]", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled),
|
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\s?★[^\[ -]+\s?)?\[?(?:(?<chinesetitle>(?=[^\]]*?[\u4E00-\u9FCC])[^\]]*?)(?:\]\[|\s*[_/·]\s*))?(?<title>[^\]]+?)\]?(?:\[\d{4}\])?\[第?(?<episode>[0-9]+(?:-[0-9]+)?)(?:话|集)?(?:END|完)?\]", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled),
|
||||||
|
|
||||||
// Some Chinese anime releases contain both Chinese and English titles, remove the Chinese title and replace with normal anime pattern
|
// Some Chinese anime releases contain both Chinese and English titles, remove the Chinese title and replace with normal anime pattern
|
||||||
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\s)(?:(?<chinesetitle>[^\]]*?[\u4E00-\u9FCC][^\]]*?)(?:\s/\s))(?<title>[^\]]+?)(?:[- ]+)(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled),
|
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\s)(?:(?<chinesetitle>(?=[^\]]*?[\u4E00-\u9FCC])[^\]]*?)(?:\s/\s))(?<title>[^\]]+?)(?:[- ]+)(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled),
|
||||||
|
|
||||||
// GM-Team releases with lots of square brackets
|
// GM-Team releases with lots of square brackets
|
||||||
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\[(?<chinesubgroup>[^\]]*?[\u4E00-\u9FCC][^\]]*?)\])(?:\[(?<chinesetitle>[^\]]*?[\u4E00-\u9FCC][^\]]*?)\])\[(?<title>[^\]]+?)\]\[(?<junk>[^\]]+?)\]\[(?<year>[^\]]+?)\]\[(?<episode>[0-9]+(?:-[0-9]+)?)\]", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled)
|
new RegexReplace(@"^\[(?<subgroup>[^\]]+)\](?:\[(?<chinesubgroup>(?=[^\]]*?[\u4E00-\u9FCC])[^\]]*?)\])(?:\[(?<chinesetitle>(?=[^\]]*?[\u4E00-\u9FCC])[^\]]*?)\])\[(?<title>[^\]]+?)\]\[(?<junk>[^\]]+?)\]\[(?<year>[^\]]+?)\]\[(?<episode>[0-9]+(?:-[0-9]+)?)\]", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex[] ReportTitleRegex = new[]
|
private static readonly Regex[] ReportTitleRegex = new[]
|
||||||
|
|
Loading…
Reference in a new issue