using System;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Users;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Serialization;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
namespace MediaBrowser.Controller.Entities.Audio
{
///
/// Class MusicAlbum
///
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo, IMetadataContainer
{
public List AlbumArtists { get; set; }
public List Artists { get; set; }
public MusicAlbum()
{
Artists = new List();
AlbumArtists = new List();
}
[IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return true; }
}
[IgnoreDataMember]
public override bool SupportsInheritedParentImages
{
get { return true; }
}
[IgnoreDataMember]
public MusicArtist MusicArtist
{
get { return GetMusicArtist(new DtoOptions(true)); }
}
public MusicArtist GetMusicArtist(DtoOptions options)
{
var artist = GetParents().OfType().FirstOrDefault();
if (artist == null)
{
var name = AlbumArtist;
if (!string.IsNullOrWhiteSpace(name))
{
artist = LibraryManager.GetArtist(name, options);
}
}
return artist;
}
[IgnoreDataMember]
public override bool SupportsPlayedStatus
{
get
{
return false;
}
}
[IgnoreDataMember]
public override bool SupportsCumulativeRunTimeTicks
{
get
{
return true;
}
}
[IgnoreDataMember]
public List AllArtists
{
get
{
var list = AlbumArtists.ToList();
list.AddRange(Artists);
return list;
}
}
[IgnoreDataMember]
public string AlbumArtist
{
get { return AlbumArtists.FirstOrDefault(); }
}
[IgnoreDataMember]
public override bool SupportsPeople
{
get { return false; }
}
///
/// Gets the tracks.
///
/// The tracks.
[IgnoreDataMember]
public IEnumerable