diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Library/TVUtils.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs | 31 |
2 files changed, 35 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 9181fe9e87..43aef88f1a 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -144,9 +144,9 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="path">The path.</param> /// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns> - public static bool IsSeasonFolder(string path) + private static bool IsSeasonFolder(string path) { - return GetSeasonNumberFromPath(path) != null; + return GetSeasonNumberFromPath(path) != null && !new DirectoryInfo(path).EnumerateFiles().Any(i => EntityResolutionHelper.IsAudioFile(i.FullName)); } /// <summary> @@ -162,12 +162,14 @@ namespace MediaBrowser.Controller.Library foreach (var child in fileSystemChildren) { - if (child.Attributes.HasFlag(FileAttributes.Hidden) || child.Attributes.HasFlag(FileAttributes.System)) + var attributes = child.Attributes; + + if (attributes.HasFlag(FileAttributes.Hidden) || attributes.HasFlag(FileAttributes.System)) { continue; } - if (child.Attributes.HasFlag(FileAttributes.Directory)) + if (attributes.HasFlag(FileAttributes.Directory)) { if (IsSeasonFolder(child.FullName)) { diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 627e1f08df..8a6225104c 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Resolvers /// Any extension in this list is considered a video file - can be added to at runtime for extensibility /// </summary> public static List<string> VideoFileExtensions = new List<string> - { + { ".mkv", ".m2t", ".m2ts", @@ -45,13 +45,40 @@ namespace MediaBrowser.Controller.Resolvers }; /// <summary> + /// The audio file extensions + /// </summary> + private static readonly string[] AudioFileExtensions = new[] { + ".mp3", + ".flac", + ".wma", + ".aac", + ".acc", + ".m4a", + ".m4b", + ".wav", + ".ape", + ".ogg", + ".oga" + }; + + /// <summary> + /// Determines whether [is audio file] [the specified args]. + /// </summary> + /// <param name="path">The path.</param> + /// <returns><c>true</c> if [is audio file] [the specified args]; otherwise, <c>false</c>.</returns> + public static bool IsAudioFile(string path) + { + return AudioFileExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase); + } + + /// <summary> /// Determines whether [is video file] [the specified path]. /// </summary> /// <param name="path">The path.</param> /// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns> public static bool IsVideoFile(string path) { - var extension = Path.GetExtension(path) ?? string.Empty; + var extension = Path.GetExtension(path) ?? String.Empty; return VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase); } |
