aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
diff options
context:
space:
mode:
authorFredrik Lindberg <fli@shapeshifter.se>2021-08-26 20:01:56 +0200
committerFredrik Lindberg <fli@shapeshifter.se>2021-09-13 17:59:33 +0200
commitea439c5ccf7a61157544accd60109afc12dbc2d2 (patch)
tree0da06983169048f5136861bfe10dc423090b0f11 /tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
parente15fea5dade9478d9667399eb0c245917d3e1513 (diff)
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.
Diffstat (limited to 'tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs')
-rw-r--r--tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs b/tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
new file mode 100644
index 0000000000..ceb5f8b736
--- /dev/null
+++ b/tests/Jellyfin.Naming.Tests/TV/SeriesPathParserTest.cs
@@ -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);
+ }
+ }
+}