The Free Software Media System - Server Backend & API
Merge branch 'master' into video-resolver
BaronGreenbackd42bb515ce36
diff --cc Emby.Naming/Common/NamingOptions.csindex c727681a65,fd4244f64d..0a7224774c--- a/Emby.Naming/Common/NamingOptions.cs+++ b/Emby.Naming/Common/NamingOptions.cs@@@ -136,10 -136,8 +136,10 @@@ namespace Emby.Naming.CommoCleanDateTimes = new[]{- @"(.+[^_\,\.\(\)\[\]\-])[_\.\(\)\[\]\-](19\d{2}|20\d{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19\d{2}|20\d{2})*",- @"(.+[^_\,\.\(\)\[\]\-])[ _\.\(\)\[\]\-]+(19\d{2}|20\d{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19\d{2}|20\d{2})*",+ @"(.+[^_\,\.\(\)\[\]\-])[_\.\(\)\[\]\-](19[0-9]{2}|20[0-9]{2})(?![0-9]+|\W[0-9]{2}\W[0-9]{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19[0-9]{2}|20[0-9]{2})*",+ @"(.+[^_\,\.\(\)\[\]\-])[ _\.\(\)\[\]\-]+(19[0-9]{2}|20[0-9]{2})(?![0-9]+|\W[0-9]{2}\W[0-9]{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19[0-9]{2}|20[0-9]{2})*"+ @"(.+\w)\W+\p{Ps}(19[0-9]{2}|20[0-9]{2})\p{Pe}", // Prefer year enclosed in parenthesis (){}[]+ @"(.+\w)\W+(19[0-9]{2}|20[0-9]{2})(\W|$)", // Secondary year surrounded by non-word chars};CleanStrings = new[]diff --cc tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.csindex 49820df629,ed971eed7b..4a01d79883--- a/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs@@@ -47,7 -47,10 +47,11 @@@ namespace Jellyfin.Naming.Tests.Vide// FIXME: [InlineData("Robin Hood [Multi-Subs] [2018].mkv", "Robin Hood", 2018)][InlineData(@"3.Days.to.Kill.2014.720p.BluRay.x264.YIFY.mkv", "3.Days.to.Kill", 2014)] // In this test case, running CleanDateTime first produces no date, so it will attempt to run CleanString first and then CleanDateTime again[InlineData("3 days to kill (2005).mkv", "3 days to kill", 2005)]+ [InlineData(@"Rain Man 1988 REMASTERED 1080p BluRay x264 AAC - Ozlem.mp4", "Rain Man", 1988)]+ [InlineData("My Movie 2013.12.09", "My Movie 2013.12.09", null)]+ [InlineData("My Movie 2013-12-09", "My Movie 2013-12-09", null)]+ [InlineData("My Movie 20131209", "My Movie 20131209", null)]+ [InlineData("My Movie 2013-12-09 2013", "My Movie 2013-12-09", 2013)]public void CleanDateTimeTest(string input, string expectedName, int? expectedYear){input = Path.GetFileName(input);