From 2b5774ccf3bd61fdd7b807035002b70e0c41ba06 Mon Sep 17 00:00:00 2001 From: scatter-dev Date: Fri, 28 Jul 2023 09:54:28 -0400 Subject: [PATCH 1/3] add parsing for date with spaces, fix for underscores --- Emby.Naming/Common/NamingOptions.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index a069da102..0872024f5 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -318,22 +318,24 @@ namespace Emby.Naming.Common new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"), // new EpisodeExpression(@"[^\\/]*?()\.?[Ee]([0-9]+)\.([^\\/]*)$"), - new EpisodeExpression("(?[0-9]{4})[\\.-](?[0-9]{2})[\\.-](?[0-9]{2})", true) + new EpisodeExpression("(?[0-9]{4})[\\.-_ ](?[0-9]{2})[\\.-_ ](?[0-9]{2})", true) { DateTimeFormats = new[] { "yyyy.MM.dd", "yyyy-MM-dd", - "yyyy_MM_dd" + "yyyy_MM_dd", + "yyyy MM dd" } }, - new EpisodeExpression(@"(?[0-9]{2})[.-](?[0-9]{2})[.-](?[0-9]{4})", true) + new EpisodeExpression(@"(?[0-9]{2})[.-_ ](?[0-9]{2})[.-_ ](?[0-9]{4})", true) { DateTimeFormats = new[] { "dd.MM.yyyy", "dd-MM-yyyy", - "dd_MM_yyyy" + "dd_MM_yyyy", + "dd MM yyyy" } }, From 14a762b2f1d5e9e6c66f86ab91e6684c6f3ff8ba Mon Sep 17 00:00:00 2001 From: scatter-dev Date: Fri, 28 Jul 2023 16:06:55 -0400 Subject: [PATCH 2/3] added test case, fixed regexes --- Emby.Naming/Common/NamingOptions.cs | 4 ++-- tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index 0872024f5..5cf0d9083 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -318,7 +318,7 @@ namespace Emby.Naming.Common new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"), // new EpisodeExpression(@"[^\\/]*?()\.?[Ee]([0-9]+)\.([^\\/]*)$"), - new EpisodeExpression("(?[0-9]{4})[\\.-_ ](?[0-9]{2})[\\.-_ ](?[0-9]{2})", true) + new EpisodeExpression(@"(?[0-9]{4})[\.\-_ ](?[0-9]{2})[\.\-_ ](?[0-9]{2})", true) { DateTimeFormats = new[] { @@ -328,7 +328,7 @@ namespace Emby.Naming.Common "yyyy MM dd" } }, - new EpisodeExpression(@"(?[0-9]{2})[.-_ ](?[0-9]{2})[.-_ ](?[0-9]{4})", true) + new EpisodeExpression(@"(?[0-9]{2})[\.\-_ ](?[0-9]{2})[\.\-_ ](?[0-9]{4})", true) { DateTimeFormats = new[] { diff --git a/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs b/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs index 72052a23c..d0d3d8292 100644 --- a/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs +++ b/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs @@ -13,6 +13,7 @@ namespace Jellyfin.Naming.Tests.TV [InlineData(@"/server/anything_1996-11-14.mp4", "anything", 1996, 11, 14)] [InlineData(@"/server/james.corden.2017.04.20.anne.hathaway.720p.hdtv.x264-crooks.mkv", "james.corden", 2017, 04, 20)] [InlineData(@"/server/ABC News 2018_03_24_19_00_00.mkv", "ABC News", 2018, 03, 24)] + [InlineData(@"/server/Jeopardy 2023 07 14 HDTV x264 AC3.mkv", "Jeopardy", 2023, 07, 14)] // TODO: [InlineData(@"/server/anything_14.11.1996.mp4", "anything", 1996, 11, 14)] // TODO: [InlineData(@"/server/A Daily Show - (2015-01-15) - Episode Name - [720p].mkv", "A Daily Show", 2015, 01, 15)] // TODO: [InlineData(@"/server/Last Man Standing_KTLADT_2018_05_25_01_28_00.wtv", "Last Man Standing", 2018, 05, 25)] From a09daa11eac1e7f47b88f2e27e8f61b3beb3b4ac Mon Sep 17 00:00:00 2001 From: scatter-dev Date: Mon, 7 Aug 2023 14:03:36 -0400 Subject: [PATCH 3/3] cleaner regex formatting --- Emby.Naming/Common/NamingOptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index 5cf0d9083..2bd089ed8 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -318,7 +318,7 @@ namespace Emby.Naming.Common new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"), // new EpisodeExpression(@"[^\\/]*?()\.?[Ee]([0-9]+)\.([^\\/]*)$"), - new EpisodeExpression(@"(?[0-9]{4})[\.\-_ ](?[0-9]{2})[\.\-_ ](?[0-9]{2})", true) + new EpisodeExpression(@"(?[0-9]{4})[._ -](?[0-9]{2})[._ -](?[0-9]{2})", true) { DateTimeFormats = new[] { @@ -328,7 +328,7 @@ namespace Emby.Naming.Common "yyyy MM dd" } }, - new EpisodeExpression(@"(?[0-9]{2})[\.\-_ ](?[0-9]{2})[\.\-_ ](?[0-9]{4})", true) + new EpisodeExpression(@"(?[0-9]{2})[._ -](?[0-9]{2})[._ -](?[0-9]{4})", true) { DateTimeFormats = new[] {