MusicVideo.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using MediaBrowser.Controller.Entities.Audio;
  2. using MediaBrowser.Controller.Providers;
  3. using MediaBrowser.Model.Configuration;
  4. using MediaBrowser.Model.Entities;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Runtime.Serialization;
  9. namespace MediaBrowser.Controller.Entities
  10. {
  11. public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasBudget, IHasLookupInfo<MusicVideoInfo>
  12. {
  13. /// <summary>
  14. /// Gets or sets the artist.
  15. /// </summary>
  16. /// <value>The artist.</value>
  17. public string Artist { get; set; }
  18. /// <summary>
  19. /// Gets or sets the album.
  20. /// </summary>
  21. /// <value>The album.</value>
  22. public string Album { get; set; }
  23. /// <summary>
  24. /// Gets or sets the budget.
  25. /// </summary>
  26. /// <value>The budget.</value>
  27. public double? Budget { get; set; }
  28. /// <summary>
  29. /// Gets or sets the revenue.
  30. /// </summary>
  31. /// <value>The revenue.</value>
  32. public double? Revenue { get; set; }
  33. [IgnoreDataMember]
  34. public List<string> AllArtists
  35. {
  36. get
  37. {
  38. var list = new List<string>();
  39. if (!string.IsNullOrEmpty(Artist))
  40. {
  41. list.Add(Artist);
  42. }
  43. return list;
  44. }
  45. }
  46. /// <summary>
  47. /// Determines whether the specified name has artist.
  48. /// </summary>
  49. /// <param name="name">The name.</param>
  50. /// <returns><c>true</c> if the specified name has artist; otherwise, <c>false</c>.</returns>
  51. public bool HasArtist(string name)
  52. {
  53. return string.Equals(Artist, name, StringComparison.OrdinalIgnoreCase);
  54. }
  55. /// <summary>
  56. /// Gets the user data key.
  57. /// </summary>
  58. /// <returns>System.String.</returns>
  59. public override string GetUserDataKey()
  60. {
  61. return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.GetUserDataKey();
  62. }
  63. protected override bool GetBlockUnratedValue(UserConfiguration config)
  64. {
  65. return config.BlockUnratedItems.Contains(UnratedItem.Music);
  66. }
  67. public MusicVideoInfo GetLookupInfo()
  68. {
  69. return GetItemLookupInfo<MusicVideoInfo>();
  70. }
  71. }
  72. }