From a4b40ad9d90a40cd5e35bb7b9c43ad436e992cd4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 13 Feb 2014 23:00:13 -0500 Subject: handle year in name when searching --- MediaBrowser.Controller/Library/TVUtils.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Controller/Library') diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 54ebf8914..82911117f 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using System; using System.Collections.Generic; @@ -182,11 +183,12 @@ namespace MediaBrowser.Controller.Library /// Determines whether [is season folder] [the specified path]. /// /// The path. + /// The directory service. /// true if [is season folder] [the specified path]; otherwise, false. - private static bool IsSeasonFolder(string path) + private static bool IsSeasonFolder(string path, IDirectoryService directoryService) { // It's a season folder if it's named as such and does not contain any audio files, apart from theme.mp3 - return GetSeasonNumberFromPath(path) != null && !Directory.EnumerateFiles(path).Any(i => EntityResolutionHelper.IsAudioFile(i) && !string.Equals(Path.GetFileNameWithoutExtension(i), BaseItem.ThemeSongFilename)); + return GetSeasonNumberFromPath(path) != null && !directoryService.GetFiles(path).Any(i => EntityResolutionHelper.IsAudioFile(i.FullName) && !string.Equals(Path.GetFileNameWithoutExtension(i.FullName), BaseItem.ThemeSongFilename)); } /// @@ -195,7 +197,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) + public static bool IsSeriesFolder(string path, IEnumerable fileSystemChildren, IDirectoryService directoryService) { // A folder with more than 3 non-season folders in will not becounted as a series var nonSeriesFolders = 0; @@ -216,7 +218,7 @@ namespace MediaBrowser.Controller.Library if ((attributes & FileAttributes.Directory) == FileAttributes.Directory) { - if (IsSeasonFolder(child.FullName)) + if (IsSeasonFolder(child.FullName, directoryService)) { return true; } -- cgit v1.2.3