MusicAlbum.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System.Linq;
  2. using System.Runtime.Serialization;
  3. namespace MediaBrowser.Controller.Entities.Audio
  4. {
  5. /// <summary>
  6. /// Class MusicAlbum
  7. /// </summary>
  8. public class MusicAlbum : Folder
  9. {
  10. public string LastFmImageUrl { get; set; }
  11. /// <summary>
  12. /// Songs will group into us so don't also include us in the index
  13. /// </summary>
  14. /// <value><c>true</c> if [include in index]; otherwise, <c>false</c>.</value>
  15. [IgnoreDataMember]
  16. public override bool IncludeInIndex
  17. {
  18. get
  19. {
  20. return false;
  21. }
  22. }
  23. /// <summary>
  24. /// Override this to true if class should be grouped under a container in indicies
  25. /// The container class should be defined via IndexContainer
  26. /// </summary>
  27. /// <value><c>true</c> if [group in index]; otherwise, <c>false</c>.</value>
  28. [IgnoreDataMember]
  29. public override bool GroupInIndex
  30. {
  31. get
  32. {
  33. return true;
  34. }
  35. }
  36. /// <summary>
  37. /// The unknwon artist
  38. /// </summary>
  39. private static readonly MusicArtist UnknwonArtist = new MusicArtist { Name = "<Unknown>" };
  40. /// <summary>
  41. /// Override this to return the folder that should be used to construct a container
  42. /// for this item in an index. GroupInIndex should be true as well.
  43. /// </summary>
  44. /// <value>The index container.</value>
  45. [IgnoreDataMember]
  46. public override Folder IndexContainer
  47. {
  48. get { return Parent as MusicArtist ?? UnknwonArtist; }
  49. }
  50. /// <summary>
  51. /// Determines whether the specified artist has artist.
  52. /// </summary>
  53. /// <param name="artist">The artist.</param>
  54. /// <returns><c>true</c> if the specified artist has artist; otherwise, <c>false</c>.</returns>
  55. public bool HasArtist(string artist)
  56. {
  57. return RecursiveChildren.OfType<Audio>().Any(i => i.HasArtist(artist));
  58. }
  59. }
  60. public class MusicAlbumDisc : Folder
  61. {
  62. }
  63. }