jellyfin/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs

40 lines
1.3 KiB
C#
Raw Normal View History

2013-02-20 18:33:05 -07:00
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
2013-02-20 18:33:05 -07:00
{
2013-02-23 00:57:11 -07:00
/// <summary>
/// Class MusicArtistResolver
/// </summary>
public class MusicArtistResolver : ItemResolver<MusicArtist>
2013-02-20 18:33:05 -07:00
{
2013-02-23 00:57:11 -07:00
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
2013-02-20 18:33:05 -07:00
public override ResolverPriority Priority
{
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
}
2013-02-23 00:57:11 -07:00
/// <summary>
/// Resolves the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>MusicArtist.</returns>
2013-02-20 18:33:05 -07:00
protected override MusicArtist Resolve(ItemResolveArgs args)
{
if (!args.IsDirectory) return null;
//Avoid mis-identifying top folders
if (args.Parent == null) return null;
if (args.Parent.IsRoot) return null;
// If we contain an album assume we are an artist folder
return args.FileSystemChildren.Any(MusicAlbumResolver.IsMusicAlbum) ? new MusicArtist() : null;
2013-02-20 18:33:05 -07:00
}
}
}