From 6ef7e71caa9f7b72eb30714e5426d563712ba511 Mon Sep 17 00:00:00 2001 From: Thomas Gillen Date: Thu, 19 Jun 2014 21:35:35 +0100 Subject: Fixed absolute episodes being being resolved and the tvdb provider not identifying them Episode resolver will only consider absolute episodes (those without a season) if the media type is TV Series for the collection. --- MediaBrowser.Controller/Library/TVUtils.cs | 37 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'MediaBrowser.Controller/Library') diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 7841a32ae..64f3a3b4b 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -93,27 +93,26 @@ namespace MediaBrowser.Controller.Library }; /// - /// To avoid the following matching movies they are only valid when contained in a folder which has been matched as a being season + /// To avoid the following matching movies they are only valid when contained in a folder which has been matched as a being season, or the media type is TV series /// - private static readonly Regex[] EpisodeExpressionsInASeasonFolder = + private static readonly Regex[] EpisodeExpressionsWithoutSeason = { new Regex( - @".*(\\|\/)(?\d{1,2})\s?-\s?[^\\\/]*$", + @".*[\\\/](?\d{1,3})\.\w+$", RegexOptions.Compiled), - // 01 - blah.avi, 01-blah.avi + // "01.avi" new Regex( - @".*(\\|\/)(?\d{1,2})[^\d\\]*[^\\\/]*$", + @".*(\\|\/)(?\d{1,2})\s?-\s?[^\\\/]*$", RegexOptions.Compiled), - // 01.avi, 01.blah.avi "01 - 22 blah.avi" - new Regex( - @".*(\\|\/)(?\d)(?\d{1,2})[^\d\\]+[^\\\/]*$", + // "01 - blah.avi", "01-blah.avi" + new Regex( + @".*(\\|\/)(?\d{1,2})\.[^\\\/]+$", RegexOptions.Compiled), - // 01.avi, 01.blah.avi + // "01.blah.avi" new Regex( - @".*(\\|\/)\D*\d+(?\d{2})", - RegexOptions.Compiled) - // hell0 - 101 - hello.avi - + @".*[\\\/][^\\\/]* - (?\d{1,3})[^\\\/]*$", + RegexOptions.Compiled), + // "blah - 01.avi", "blah 2 - 01.avi", "blah - 01 blah.avi", "blah 2 - 01 blah", "blah - 01 - blah.avi", "blah 2 - 01 - blah" }; /// @@ -197,7 +196,7 @@ namespace MediaBrowser.Controller.Library /// The path. /// The file system children. /// true if [is series folder] [the specified path]; otherwise, false. - public static bool IsSeriesFolder(string path, IEnumerable fileSystemChildren, IDirectoryService directoryService) + public static bool IsSeriesFolder(string path, bool considerSeasonlessSeries, IEnumerable fileSystemChildren, IDirectoryService directoryService) { // A folder with more than 3 non-season folders in will not becounted as a series var nonSeriesFolders = 0; @@ -236,7 +235,7 @@ namespace MediaBrowser.Controller.Library if (EntityResolutionHelper.IsVideoFile(fullName) || EntityResolutionHelper.IsVideoPlaceHolder(fullName)) { - if (GetEpisodeNumberFromFile(fullName, false).HasValue) + if (GetEpisodeNumberFromFile(fullName, considerSeasonlessSeries).HasValue) { return true; } @@ -251,9 +250,9 @@ namespace MediaBrowser.Controller.Library /// Episodes the number from file. /// /// The full path. - /// if set to true [is in season]. + /// if set to true [is in season]. /// System.String. - public static int? GetEpisodeNumberFromFile(string fullPath, bool isInSeason) + public static int? GetEpisodeNumberFromFile(string fullPath, bool considerSeasonlessNames) { string fl = fullPath.ToLower(); foreach (var r in EpisodeExpressions) @@ -262,9 +261,9 @@ namespace MediaBrowser.Controller.Library if (m.Success) return ParseEpisodeNumber(m.Groups["epnumber"].Value); } - if (isInSeason) + if (considerSeasonlessNames) { - var match = EpisodeExpressionsInASeasonFolder.Select(r => r.Match(fl)) + var match = EpisodeExpressionsWithoutSeason.Select(r => r.Match(fl)) .FirstOrDefault(m => m.Success); if (match != null) -- cgit v1.2.3