Fixed: Chinese releases with season and absolute episode numbers

pull/5367/head
Xavier Xiong 2 years ago committed by GitHub
parent facf775a43
commit f742e1f174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,6 +41,25 @@ namespace NzbDrone.Core.Test.ParserTests
result.FullSeason.Should().BeFalse();
}
[TestCase("[Lilith-Raws] / Anime-Series Title S04 - 12 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]", "Anime-Series Title", "Lilith-Raws", 4, 12)]
[TestCase("[Lilith-Raws] / Anime-Series Title S02 - 01 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]", "Anime-Series Title", "Lilith-Raws", 2, 1)]
[TestCase("[Lilith-Raws] / Anime-Series Title S02 - 01 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]", "Anime-Series Title", "Lilith-Raws", 2, 1)]
[TestCase("[SweetSub&LoliHouse] / Anime-Series Title S2 - 07 [WebRip 1080p HEVC-10bit AAC][]", "Anime-Series Title", "SweetSub&LoliHouse", 2, 7)]
[TestCase("[LoliHouse] Love Live! / Anime-Series Title S2 - 10 [WebRip 1080p HEVC-10bit AAC][]", "Anime-Series Title", "LoliHouse", 2, 10)]
[TestCase("[澄空学园&雪飘工作室&LoliHouse] / Anime-Series Title S3 - 06 [WebRip 1080p HEVC-10bit AAC][]", "Anime-Series Title", "&&LoliHouse", 3, 6)]
public void should_parse_chinese_anime_season_episode_releases(string postTitle, string title, string subgroup, int seasonNumber, int episodeNumber)
{
postTitle = XmlCleaner.ReplaceUnicode(postTitle);
var result = Parser.Parser.ParseTitle(postTitle);
result.Should().NotBeNull();
result.ReleaseGroup.Should().Be(subgroup);
result.SeasonNumber.Should().Be(seasonNumber);
result.EpisodeNumbers.Single().Should().Be(episodeNumber);
result.SeriesTitle.Should().Be(title);
result.FullSeason.Should().BeFalse();
}
[TestCase("[喵萌奶茶屋&LoliHouse]/Anime Series Title - 03 [WebRip 1080p HEVC-10bit AAC][]", "Anime Series Title", "&LoliHouse", 3)]
[TestCase("[悠哈璃羽字幕社&拉斯观测组&LoliHouse] : Alicization / Anime Series: Title - 17 [WebRip 1080p HEVC-10bit AAC][]", "Anime Series: Title", "&&LoliHouse", 17)]
[TestCase("[ZERO字幕組]·Anime-Series Title[11][BIG5][1080p]", "Anime-Series Title", "ZERO", 11)]

@ -25,6 +25,9 @@ namespace NzbDrone.Core.Parser
// 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),
// Chinese LoliHouse/Lilith-Raws releases use Season + Absolute Episode Number, normalize using SxxExx format
new RegexReplace(@"^\[(?<subgroup>[^\]]*?(?:LoliHouse|ZERO|Lilith-Raws)[^\]]*?)\].*/(?<title>[^\[\]]+?)(?:S?(?<season>(?<!\d+)\d{1,2}(?!\d+)))(?: - (?<episode>[0-9-]+)\s*|\[第?(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?\])\[", "[${subgroup}] ${title} S${season}E${episode} [", RegexOptions.Compiled),
// Chinese LoliHouse/ZERO/Lilith-Raws releases don't use the expected brackets, normalize using brackets
new RegexReplace(@"^\[(?<subgroup>[^\]]*?(?:LoliHouse|ZERO|Lilith-Raws)[^\]]*?)\](?<title>[^\[\]]+?)(?: - (?<episode>[0-9-]+)\s*|\[第?(?<episode>[0-9]+(?:-[0-9]+)?)话?(?:END|完)?\])\[", "[${subgroup}][${title}][${episode}][", RegexOptions.Compiled),

Loading…
Cancel
Save