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
///
/// The path.
/// true if [is season folder] [the specified path]; otherwise, false.
- 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));
}
///
@@ -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
///
public static List VideoFileExtensions = new List
- {
+ {
".mkv",
".m2t",
".m2ts",
@@ -44,6 +44,33 @@ namespace MediaBrowser.Controller.Resolvers
".webm"
};
+ ///
+ /// The audio file extensions
+ ///
+ private static readonly string[] AudioFileExtensions = new[] {
+ ".mp3",
+ ".flac",
+ ".wma",
+ ".aac",
+ ".acc",
+ ".m4a",
+ ".m4b",
+ ".wav",
+ ".ape",
+ ".ogg",
+ ".oga"
+ };
+
+ ///
+ /// Determines whether [is audio file] [the specified args].
+ ///
+ /// The path.
+ /// true if [is audio file] [the specified args]; otherwise, false.
+ public static bool IsAudioFile(string path)
+ {
+ return AudioFileExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase);
+ }
+
///
/// Determines whether [is video file] [the specified path].
///
@@ -51,7 +78,7 @@ namespace MediaBrowser.Controller.Resolvers
/// true if [is video file] [the specified path]; otherwise, false.
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);
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
index b19ec2815c..3c6cc654fc 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -1,8 +1,5 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
-using System;
-using System.IO;
-using System.Linq;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
@@ -31,7 +28,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
if (!args.IsDirectory)
{
- if (IsAudioFile(args.Path))
+ if (EntityResolutionHelper.IsAudioFile(args.Path))
{
return new Controller.Entities.Audio.Audio();
}
@@ -39,32 +36,5 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
return null;
}
-
- ///
- /// The audio file extensions
- ///
- public static readonly string[] AudioFileExtensions = new[] {
- ".mp3",
- ".flac",
- ".wma",
- ".aac",
- ".acc",
- ".m4a",
- ".m4b",
- ".wav",
- ".ape",
- ".ogg",
- ".oga"
- };
-
- ///
- /// Determines whether [is audio file] [the specified args].
- ///
- /// The path.
- /// true if [is audio file] [the specified args]; otherwise, false.
- public static bool IsAudioFile(string path)
- {
- return AudioFileExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase);
- }
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index f24d23208b..411e431aa3 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -51,7 +51,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
foreach (var fullName in new DirectoryInfo(path).EnumerateFiles().Select(file => file.FullName))
{
- if (AudioResolver.IsAudioFile(fullName)) foundAudio++;
+ if (EntityResolutionHelper.IsAudioFile(fullName)) foundAudio++;
if (foundAudio >= 2)
{
return true;
@@ -93,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
foreach (var file in list)
{
- if (AudioResolver.IsAudioFile(file.FullName)) foundAudio++;
+ if (EntityResolutionHelper.IsAudioFile(file.FullName)) foundAudio++;
if (foundAudio >= 2)
{
return true;