using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Logging;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.Music
{
///
/// Class MusicAlbumDynamicInfoProvider
///
public class AlbumDynamicInfoProvider : BaseMetadataProvider, IDynamicInfoProvider
{
///
/// Initializes a new instance of the class.
///
/// The log manager.
/// The configuration manager.
public AlbumDynamicInfoProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
: base(logManager, configurationManager)
{
}
///
/// Supportses the specified item.
///
/// The item.
/// true if XXXX, false otherwise
public override bool Supports(BaseItem item)
{
return item is MusicAlbum;
}
///
/// Needses the refresh internal.
///
/// The item.
/// The provider info.
/// true if XXXX, false otherwise
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
return true;
}
///
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
///
/// The item.
/// if set to true [force].
/// The cancellation token.
/// Task{System.Boolean}.
public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
{
var album = (MusicAlbum)item;
var songs = album.RecursiveChildren
.OfType