2019-11-08 18:59:48 +00:00
|
|
|
|
using Emby.Naming.Common;
|
|
|
|
|
using Emby.Naming.TV;
|
|
|
|
|
using Xunit;
|
2019-10-10 03:09:16 +00:00
|
|
|
|
|
2019-12-06 19:40:06 +00:00
|
|
|
|
namespace Jellyfin.Naming.Tests.TV
|
2019-11-08 18:59:48 +00:00
|
|
|
|
{
|
2019-10-10 03:09:16 +00:00
|
|
|
|
public class EpisodePathParserTest
|
|
|
|
|
{
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData("/media/Foo/Foo-S01E01", "Foo", 1, 1)]
|
|
|
|
|
[InlineData("/media/Foo - S04E011", "Foo", 4, 11)]
|
|
|
|
|
[InlineData("/media/Foo/Foo s01x01", "Foo", 1, 1)]
|
2019-10-11 02:46:51 +00:00
|
|
|
|
[InlineData("/media/Foo (2019)/Season 4/Foo (2019).S04E03", "Foo (2019)", 4, 3)]
|
2019-12-18 10:52:32 +00:00
|
|
|
|
[InlineData("D:\\media\\Foo\\Foo-S01E01", "Foo", 1, 1)]
|
|
|
|
|
[InlineData("D:\\media\\Foo - S04E011", "Foo", 4, 11)]
|
|
|
|
|
[InlineData("D:\\media\\Foo\\Foo s01x01", "Foo", 1, 1)]
|
|
|
|
|
[InlineData("D:\\media\\Foo (2019)\\Season 4\\Foo (2019).S04E03", "Foo (2019)", 4, 3)]
|
2019-10-10 03:09:16 +00:00
|
|
|
|
public void ParseEpisodesCorrectly(string path, string name, int season, int episode)
|
|
|
|
|
{
|
|
|
|
|
NamingOptions o = new NamingOptions();
|
|
|
|
|
EpisodePathParser p = new EpisodePathParser(o);
|
|
|
|
|
var res = p.Parse(path, false);
|
|
|
|
|
|
|
|
|
|
Assert.True(res.Success);
|
|
|
|
|
Assert.Equal(name, res.SeriesName);
|
|
|
|
|
Assert.Equal(season, res.SeasonNumber);
|
|
|
|
|
Assert.Equal(episode, res.EpisodeNumber);
|
2019-10-11 02:46:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
2019-10-11 10:24:55 +00:00
|
|
|
|
[InlineData("/media/Foo/Foo 889", "Foo", 889)]
|
2019-11-08 18:59:48 +00:00
|
|
|
|
[InlineData("/media/Foo/[Bar] Foo Baz - 11 [1080p]", "Foo Baz", 11)]
|
2019-12-18 10:52:32 +00:00
|
|
|
|
[InlineData("D:\\media\\Foo\\Foo 889", "Foo", 889)]
|
|
|
|
|
[InlineData("D:\\media\\Foo\\[Bar] Foo Baz - 11 [1080p]", "Foo Baz", 11)]
|
2019-10-11 02:46:51 +00:00
|
|
|
|
public void ParseEpisodeWithoutSeason(string path, string name, int episode)
|
|
|
|
|
{
|
|
|
|
|
NamingOptions o = new NamingOptions();
|
|
|
|
|
EpisodePathParser p = new EpisodePathParser(o);
|
2019-11-08 18:59:48 +00:00
|
|
|
|
var res = p.Parse(path, true, fillExtendedInfo: true);
|
2019-10-11 02:46:51 +00:00
|
|
|
|
|
|
|
|
|
Assert.True(res.Success);
|
|
|
|
|
Assert.Equal(name, res.SeriesName);
|
2019-11-08 18:59:48 +00:00
|
|
|
|
Assert.Null(res.SeasonNumber);
|
2019-10-11 02:46:51 +00:00
|
|
|
|
Assert.Equal(episode, res.EpisodeNumber);
|
2019-10-10 03:09:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-08 18:59:48 +00:00
|
|
|
|
}
|