From 79d34c590ea4d0b1772fff77c9f5b52991d460b4 Mon Sep 17 00:00:00 2001 From: mammo0 Date: Wed, 15 Mar 2023 11:52:22 +0100 Subject: [PATCH 1/4] removed unnecessary file stacking rule This rule did not check for a parttype. According to the documantation (https://jellyfin.org/docs/general/server/media/shows/#episodes-split-across-multiple-parts) there should be one. --- Emby.Naming/Common/NamingOptions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index e9161a6b7..39c3ceeb3 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -141,8 +141,7 @@ namespace Emby.Naming.Common VideoFileStackingRules = new[] { new FileStackRule(@"^(?.*?)(?:(?<=[\]\)\}])|[ _.-]+)[\(\[]?(?cd|dvd|part|pt|dis[ck])[ _.-]*(?[0-9]+)[\)\]]?(?:\.[^.]+)?$", true), - new FileStackRule(@"^(?.*?)(?:(?<=[\]\)\}])|[ _.-]+)[\(\[]?(?cd|dvd|part|pt|dis[ck])[ _.-]*(?[a-d])[\)\]]?(?:\.[^.]+)?$", false), - new FileStackRule(@"^(?.*?)(?:(?<=[\]\)\}])|[ _.-]?)(?[a-d])(?:\.[^.]+)?$", false) + new FileStackRule(@"^(?.*?)(?:(?<=[\]\)\}])|[ _.-]+)[\(\[]?(?cd|dvd|part|pt|dis[ck])[ _.-]*(?[a-d])[\)\]]?(?:\.[^.]+)?$", false) }; CleanDateTimes = new[] From 1c57c52474799fb7bcba3c5f08098e348f214590 Mon Sep 17 00:00:00 2001 From: mammo0 Date: Wed, 15 Mar 2023 11:54:44 +0100 Subject: [PATCH 2/4] fixed stacking test cases Movies should not be stacked if no parttype is given. --- tests/Jellyfin.Naming.Tests/Video/StackTests.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Jellyfin.Naming.Tests/Video/StackTests.cs b/tests/Jellyfin.Naming.Tests/Video/StackTests.cs index 368c3592e..97b52f749 100644 --- a/tests/Jellyfin.Naming.Tests/Video/StackTests.cs +++ b/tests/Jellyfin.Naming.Tests/Video/StackTests.cs @@ -236,7 +236,7 @@ namespace Jellyfin.Naming.Tests.Video } [Fact] - public void TestFalsePositive() + public void TestMissingParttype() { var files = new[] { @@ -248,9 +248,8 @@ namespace Jellyfin.Naming.Tests.Video var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); - Assert.Single(result); - - TestStackInfo(result[0], "300", 3); + // There should be no stack, because all files should be treated as separate movies + Assert.Empty(result); } [Fact] @@ -297,11 +296,11 @@ namespace Jellyfin.Naming.Tests.Video var result = StackResolver.ResolveFiles(files, _namingOptions).ToList(); - Assert.Equal(3, result.Count); + // Only 'Bad Boys (2006)' and '300 (2006)' should be in the stack + Assert.Equal(2, result.Count); TestStackInfo(result[0], "300 (2006)", 4); - TestStackInfo(result[1], "300", 3); - TestStackInfo(result[2], "Bad Boys (2006)", 4); + TestStackInfo(result[1], "Bad Boys (2006)", 4); } [Fact] From 90e8aad05d93842c7400b0ff5326e69fe5e7b48e Mon Sep 17 00:00:00 2001 From: mammo0 Date: Wed, 15 Mar 2023 11:56:11 +0100 Subject: [PATCH 3/4] fixed FourSisters test case The files should be treated as separate movies and should not be stacked, because the parttype is missing. --- tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs index cc9cfdd7d..6f9ae7307 100644 --- a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs +++ b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs @@ -332,7 +332,9 @@ namespace Jellyfin.Naming.Tests.Video files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType().ToList(), _namingOptions).ToList(); - Assert.Single(result); + // The result should contain to individual movies + // Version grouping should not work here, because the files are not in a directory with the name 'Four Sisters and a Wedding' + Assert.Equal(2, result.Count); } [Fact] From 0fd46a100ba94aca06c60b44e063f62523371ec6 Mon Sep 17 00:00:00 2001 From: mammo0 Date: Wed, 15 Mar 2023 13:01:39 +0100 Subject: [PATCH 4/4] fixed typo Co-authored-by: Shadowghost --- tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs index 6f9ae7307..0316377d4 100644 --- a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs +++ b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs @@ -332,7 +332,7 @@ namespace Jellyfin.Naming.Tests.Video files.Select(i => VideoResolver.Resolve(i, false, _namingOptions)).OfType().ToList(), _namingOptions).ToList(); - // The result should contain to individual movies + // The result should contain two individual movies // Version grouping should not work here, because the files are not in a directory with the name 'Four Sisters and a Wedding' Assert.Equal(2, result.Count); }