mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	fixes #207 - Music Content Showing as TV Content (songs as episodes)
This commit is contained in:
		
							parent
							
								
									f22c379a13
								
							
						
					
					
						commit
						08e4f959a2
					
				@ -144,9 +144,9 @@ namespace MediaBrowser.Controller.Library
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="path">The path.</param>
 | 
					        /// <param name="path">The path.</param>
 | 
				
			||||||
        /// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns>
 | 
					        /// <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>
 | 
					        /// <summary>
 | 
				
			||||||
@ -162,12 +162,14 @@ namespace MediaBrowser.Controller.Library
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            foreach (var child in fileSystemChildren)
 | 
					            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;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (child.Attributes.HasFlag(FileAttributes.Directory))
 | 
					                if (attributes.HasFlag(FileAttributes.Directory))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (IsSeasonFolder(child.FullName))
 | 
					                    if (IsSeasonFolder(child.FullName))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
					        /// Any extension in this list is considered a video file - can be added to at runtime for extensibility
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public static List<string> VideoFileExtensions = new List<string>
 | 
					        public static List<string> VideoFileExtensions = new List<string>
 | 
				
			||||||
        {
 | 
					            {
 | 
				
			||||||
                ".mkv",
 | 
					                ".mkv",
 | 
				
			||||||
                ".m2t",
 | 
					                ".m2t",
 | 
				
			||||||
                ".m2ts",
 | 
					                ".m2ts",
 | 
				
			||||||
@ -44,6 +44,33 @@ namespace MediaBrowser.Controller.Resolvers
 | 
				
			|||||||
                ".webm"
 | 
					                ".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>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Determines whether [is video file] [the specified path].
 | 
					        /// Determines whether [is video file] [the specified path].
 | 
				
			||||||
        /// </summary>
 | 
					        /// </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>
 | 
					        /// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
 | 
				
			||||||
        public static bool IsVideoFile(string path)
 | 
					        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);
 | 
					            return VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,5 @@
 | 
				
			|||||||
using MediaBrowser.Controller.Library;
 | 
					using MediaBrowser.Controller.Library;
 | 
				
			||||||
using MediaBrowser.Controller.Resolvers;
 | 
					using MediaBrowser.Controller.Resolvers;
 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using System.IO;
 | 
					 | 
				
			||||||
using System.Linq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
 | 
					namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -31,7 +28,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (!args.IsDirectory)
 | 
					            if (!args.IsDirectory)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (IsAudioFile(args.Path))
 | 
					                if (EntityResolutionHelper.IsAudioFile(args.Path))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    return new Controller.Entities.Audio.Audio();
 | 
					                    return new Controller.Entities.Audio.Audio();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -39,32 +36,5 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            return null;
 | 
					            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))
 | 
					            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)
 | 
					                if (foundAudio >= 2)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
@ -93,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            foreach (var file in list)
 | 
					            foreach (var file in list)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (AudioResolver.IsAudioFile(file.FullName)) foundAudio++;
 | 
					                if (EntityResolutionHelper.IsAudioFile(file.FullName)) foundAudio++;
 | 
				
			||||||
                if (foundAudio >= 2)
 | 
					                if (foundAudio >= 2)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user