Fixed: Parsing of additional GM-Team formats

pull/5261/head
penggongkui 2 years ago committed by GitHub
parent e77be24c7b
commit 8eb941d590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,7 +78,12 @@ namespace NzbDrone.Core.Test.ParserTests
}
[TestCase("[GM-Team][][][Anime Title][Douro Mainland][2019][215][AVC][GB][1080P]", "Anime Title", 215)]
[TestCase("[GM-Team][][][Anime Title][Douro Mainland][2019][215 END][AVC][GB][1080P]", "Anime Title", 215)]
[TestCase("[GM-Team][][][Anime Title][2019][215 Fin][AVC][GB][1080P]", "Anime Title", 215)]
[TestCase("[GM-Team][][Anime Title][Douro Mainland][2019][234][AVC][GB][1080P]", "Anime Title", 234)]
[TestCase("[GM-Team][][Anime Title][2019][234][AVC][GB][1080P]", "Anime Title", 234)]
[TestCase("[GM-Team][][Anime Title][2019][234 END][AVC][GB][1080P]", "Anime Title", 234)]
[TestCase("[GM-Team][][Anime Title][2019][234 Fin][AVC][GB][1080P]", "Anime Title", 234)]
public void should_parse_gm_team_releases_and_files(string postTitle, string title, int absoluteEpisodeNumber)
{
var result = Parser.Parser.ParseTitle(postTitle);

@ -29,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),
// 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|完| ?Fin)?\]", "[${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
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
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])[^\]]*\])+)\[(?<title>[^\]]+?)\](?<junk>\[[^\]]+\])*\[(?<episode>[0-9]+(?:-[0-9]+)?)( END| Fin)?\]", "[${subgroup}] ${title} - ${episode} ", RegexOptions.Compiled)
};
private static readonly Regex[] ReportTitleRegex = new[]

Loading…
Cancel
Save