mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
Improve series name matching
Add a series path resolver that attempts to extract only the series name from a path that contains more information that just the name.
This commit is contained in:
28
tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
Normal file
28
tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Emby.Naming.Common;
|
||||
using Emby.Naming.TV;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.Naming.Tests.TV
|
||||
{
|
||||
public class SeriesPathParserTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("The.Show.S01", "The.Show")]
|
||||
[InlineData("/The.Show.S01", "The.Show")]
|
||||
[InlineData("/some/place/The.Show.S01", "The.Show")]
|
||||
[InlineData("/something/The.Show.S01", "The.Show")]
|
||||
[InlineData("The Show Season 10", "The Show")]
|
||||
[InlineData("The Show S01E01", "The Show")]
|
||||
[InlineData("The Show S01E01 Episode", "The Show")]
|
||||
[InlineData("/something/The Show/Season 1", "The Show")]
|
||||
[InlineData("/something/The Show/S01", "The Show")]
|
||||
public void SeriesPathParserParseTest(string path, string name)
|
||||
{
|
||||
NamingOptions o = new NamingOptions();
|
||||
var res = SeriesPathParser.Parse(o, path);
|
||||
|
||||
Assert.Equal(name, res.SeriesName);
|
||||
Assert.True(res.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.cs
Normal file
28
tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Emby.Naming.Common;
|
||||
using Emby.Naming.TV;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.Naming.Tests.TV
|
||||
{
|
||||
public class SeriesResolverTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("The.Show.S01", "The Show")]
|
||||
[InlineData("The.Show.S01.COMPLETE", "The Show")]
|
||||
[InlineData("S.H.O.W.S01", "S.H.O.W")]
|
||||
[InlineData("The.Show.P.I.S01", "The Show P.I")]
|
||||
[InlineData("The_Show_Season_1", "The Show")]
|
||||
[InlineData("/something/The_Show/Season 10", "The Show")]
|
||||
[InlineData("The Show", "The Show")]
|
||||
[InlineData("/some/path/The Show", "The Show")]
|
||||
[InlineData("/some/path/The Show s02e10 720p hdtv", "The Show")]
|
||||
[InlineData("/some/path/The Show s02e10 the episode 720p hdtv", "The Show")]
|
||||
public void SeriesResolverResolveTest(string path, string name)
|
||||
{
|
||||
NamingOptions o = new NamingOptions();
|
||||
var res = SeriesResolver.Resolve(o, path);
|
||||
|
||||
Assert.Equal(name, res.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user