using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; using System; namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio { /// /// Class AudioResolver /// public class AudioResolver : ItemResolver { /// /// Gets the priority. /// /// The priority. public override ResolverPriority Priority { get { return ResolverPriority.Last; } } /// /// Resolves the specified args. /// /// The args. /// Entities.Audio.Audio. protected override Controller.Entities.Audio.Audio Resolve(ItemResolveArgs args) { // Return audio if the path is a file and has a matching extension if (!args.IsDirectory) { if (EntityResolutionHelper.IsAudioFile(args.Path)) { var collectionType = args.GetCollectionType(); if (string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(collectionType)) { return new Controller.Entities.Audio.Audio(); } } } return null; } } }