fixes #207 - Music Content Showing as TV Content (songs as episodes)

pull/702/head
Luke Pulverenti 12 years ago
parent f22c379a13
commit 08e4f959a2

@ -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))
{

@ -44,6 +44,33 @@ namespace MediaBrowser.Controller.Resolvers
".webm"
};
/// <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>
@ -51,7 +78,7 @@ namespace MediaBrowser.Controller.Resolvers
/// <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);
}

@ -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;
}
/// <summary>
/// The audio file extensions
/// </summary>
public 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);
}
}
}

@ -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;

Loading…
Cancel
Save