You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/src/NzbDrone.Core.Test/ParserTests/UnicodeReleaseParserFixture.cs

71 lines
5.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Test.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NzbDrone.Core.Test.ParserTests
{
[TestFixture]
public class UnicodeReleaseParserFixture : CoreTest
{
[TestCase("【喵萌奶茶屋】★10月新番★[哥布林杀手/Goblin Slayer][12END][720p][][]", "Goblin Slayer", "", 12)]
[TestCase("[桜都字幕组][/Tate no Yuusha no Nariagari][01][BIG5][720P]", "Tate no Yuusha no Nariagari", "", 1)]
[TestCase("[YMDR][][Kaguya-sama wa Kokurasetai][2019][02][1080p][HEVC][JAP][BIG5][MP4-AAC][]", "Kaguya-sama wa Kokurasetai", "YMDR", 2)]
[TestCase("【DHR百合組】[天使降臨到我身邊_Watashi ni Tenshi ga Maiorita!][05][][1080P10][WebRip][HEVC][MP4]", "Watashi ni Tenshi ga Maiorita!", "DHR", 5)]
[TestCase("【傲娇零&自由字幕组】[刀剑神域III UnderWorld/ Sword Art Online - Alicization ][17][HEVC-10Bit-2160P AAC][GB/BIG5][WEB-Rip][MKV+ass ]", "Sword Art Online - Alicization", "&", 17)]
[TestCase("【悠哈璃羽字幕社&拉斯观测组】[刀剑神域Alicization _ Sword Art Online - Alicization ][17][x264 1080p][CHS]", "Sword Art Online - Alicization", "", 17)]
[TestCase("【极影字幕社】 ★04月新番 【巴哈姆特之怒 Virgin Soul】【Shingeki no Bahamut Virgin Soul】【24】 【END】GB MP4_720P", "Shingeki no Bahamut Virgin Soul", "极影字幕社", 24)]
[TestCase("[愛戀&漫貓字幕组][10][][18][720P][BIG5][MP4]", "", "&", 18)]
[TestCase("【咕咕茶字幕組】★1月新番[天使降臨到了我身邊! / Watashi ni Tenshi ga Maiorita!][04][1080P][][MP4]", "Watashi ni Tenshi ga Maiorita!", "", 4)]
[TestCase("【千夏字幕组】【天使降临到了我身边_Watashi ni Tenshi ga Maiorita!】[第05话][1080p_HEVC][]", "Watashi ni Tenshi ga Maiorita!", "", 5)]
[TestCase("【DHR动研字幕组】[多田君不恋爱_Tada-kun wa Koi wo Shinai][13][][720P][MP4]", "Tada-kun wa Koi wo Shinai", "DHR", 13)]
[TestCase("【动漫国字幕组】★01月新番[Endro][01][1080P][][MP4]", "Endro", "", 1)]
public void should_parse_chinese_anime_releases(string postTitle, string title, string subgroup, int absoluteEpisodeNumber)
{
postTitle = XmlCleaner.ReplaceUnicode(postTitle);
var result = Parser.Parser.ParseTitle(postTitle);
result.Should().NotBeNull();
result.ReleaseGroup.Should().Be(subgroup);
result.AbsoluteEpisodeNumbers.Single().Should().Be(absoluteEpisodeNumber);
result.SeriesTitle.Should().Be(title);
result.FullSeason.Should().BeFalse();
}
[TestCase("[喵萌奶茶屋&LoliHouse]/Manaria Friends - 03 [WebRip 1080p HEVC-10bit AAC][]", "Manaria Friends", "&LoliHouse", 3)]
[TestCase("[悠哈璃羽字幕社&拉斯观测组&LoliHouse] : Alicization / Sword Art Online: Alicization - 17 [WebRip 1080p HEVC-10bit AAC][]", "Sword Art Online Alicization", "&&LoliHouse", 17)]
[TestCase("[ZERO字幕組]·Jingai-san no Yome[11][BIG5][1080p]", "Jingai-san no Yome", "ZERO", 11)]
public void should_parse_unbracketed_chinese_anime_releases(string postTitle, string title, string subgroup, int absoluteEpisodeNumber)
{
postTitle = XmlCleaner.ReplaceUnicode(postTitle);
var result = Parser.Parser.ParseTitle(postTitle);
result.Should().NotBeNull();
result.ReleaseGroup.Should().Be(subgroup);
result.AbsoluteEpisodeNumbers.Single().Should().Be(absoluteEpisodeNumber);
result.SeriesTitle.Should().Be(title);
result.FullSeason.Should().BeFalse();
}
[TestCase("[YMDR][ --][Boruto -Naruto Next Generations-][2017][88-91][1080p][AVC][JAP][BIG5][MP4-AAC][]", "Boruto -Naruto Next Generations", "YMDR", new[] { 88, 89, 90, 91 })]
[TestCase("[诸神字幕组][][BANANA FISH][01-24][][720P][MP4]", "BANANA FISH", "", new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 })]
//[TestCase("【漫貓&愛戀字幕組】[五等分的新娘/五等分的花嫁/五等分の花嫁][Go-Toubun_no_Hanayome][01_03][BIG5][720P][HEVC]", "Go-Toubun no Hanayome", "漫貓&愛戀字幕組", new[] { 1, 2, 3 })]
public void should_parse_chinese_multiepisode_releases(string postTitle, string title, string subgroup, int[] absoluteEpisodeNumbers)
{
postTitle = XmlCleaner.ReplaceUnicode(postTitle);
var result = Parser.Parser.ParseTitle(postTitle);
result.Should().NotBeNull();
result.ReleaseGroup.Should().Be(subgroup);
result.AbsoluteEpisodeNumbers.Should().BeEquivalentTo(absoluteEpisodeNumbers);
result.SeriesTitle.Should().Be(title);
result.FullSeason.Should().BeFalse();
}
}
}