New: Parse some additional Chinese anime releases

Closes #5024
pull/5027/head
Mark McDowall 3 years ago
parent a81a80a00f
commit 6a7d84f134

@ -26,6 +26,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("[星空字幕组] / Anime Series Title [05][1080p][]", "Anime Series Title", "", 5)] [TestCase("[星空字幕组] / Anime Series Title [05][1080p][]", "Anime Series Title", "", 5)]
[TestCase("【DHR动研字幕组】[多田君不恋爱_Anime Series Title][13][][720P][MP4]", "Anime Series Title", "DHR", 13)] [TestCase("【DHR动研字幕组】[多田君不恋爱_Anime Series Title][13][][720P][MP4]", "Anime Series Title", "DHR", 13)]
[TestCase("【动漫国字幕组】★01月新番[Anime Series Title][01][1080P][][MP4]", "Anime Series Title", "", 1)] [TestCase("【动漫国字幕组】★01月新番[Anime Series Title][01][1080P][][MP4]", "Anime Series Title", "", 1)]
[TestCase("[OPFans楓雪動漫][ONE PIECE ][1008][][1080P][MKV][]", "ONE PIECE", "OPFans", 1008)]
public void should_parse_chinese_anime_releases(string postTitle, string title, string subgroup, int absoluteEpisodeNumber) public void should_parse_chinese_anime_releases(string postTitle, string title, string subgroup, int absoluteEpisodeNumber)
{ {
postTitle = XmlCleaner.ReplaceUnicode(postTitle); postTitle = XmlCleaner.ReplaceUnicode(postTitle);

@ -9,7 +9,6 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation; using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Languages;
using System.Text; using System.Text;
namespace NzbDrone.Core.Parser namespace NzbDrone.Core.Parser
@ -30,7 +29,10 @@ namespace NzbDrone.Core.Parser
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),
// Some Chinese anime releases contain both English and Chinese titles, remove the Chinese title and replace with normal anime pattern
new RegexReplace(@"^\[(?:(?<subgroup>[^\]]+?)(?:[\u4E00-\u9FCC]+))\]\[(?<title>[^\]]+?)(?:\s(?<chinesetitle>[\u4E00-\u9FCC][^\]]*?))\]\[(?:(?:[\u4E00-\u9FCC]+?)(?<episode>\d{1,4})(?:[\u4E00-\u9FCC]+?))\]", "[${subgroup}] ${title} - ${episode} - ", RegexOptions.Compiled)
}; };
private static readonly Regex[] ReportTitleRegex = new[] private static readonly Regex[] ReportTitleRegex = new[]

Loading…
Cancel
Save