MusicVideo.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using MediaBrowser.Controller.Entities.Audio;
  2. using MediaBrowser.Controller.Providers;
  3. using MediaBrowser.Model.Configuration;
  4. using MediaBrowser.Model.Entities;
  5. using System.Collections.Generic;
  6. using System.Runtime.Serialization;
  7. namespace MediaBrowser.Controller.Entities
  8. {
  9. public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasProductionLocations, IHasBudget, IHasLookupInfo<MusicVideoInfo>
  10. {
  11. /// <summary>
  12. /// Gets or sets the budget.
  13. /// </summary>
  14. /// <value>The budget.</value>
  15. public double? Budget { get; set; }
  16. /// <summary>
  17. /// Gets or sets the revenue.
  18. /// </summary>
  19. /// <value>The revenue.</value>
  20. public double? Revenue { get; set; }
  21. public List<string> ProductionLocations { get; set; }
  22. public List<string> Artists { get; set; }
  23. public MusicVideo()
  24. {
  25. ProductionLocations = new List<string>();
  26. Artists = new List<string>();
  27. }
  28. [IgnoreDataMember]
  29. public List<string> AllArtists
  30. {
  31. get
  32. {
  33. return Artists;
  34. }
  35. }
  36. public override UnratedItem GetBlockUnratedType()
  37. {
  38. return UnratedItem.Music;
  39. }
  40. public MusicVideoInfo GetLookupInfo()
  41. {
  42. return GetItemLookupInfo<MusicVideoInfo>();
  43. }
  44. public override bool BeforeMetadataRefresh()
  45. {
  46. var hasChanges = base.BeforeMetadataRefresh();
  47. if (!ProductionYear.HasValue)
  48. {
  49. var info = LibraryManager.ParseName(Name);
  50. var yearInName = info.Year;
  51. if (yearInName.HasValue)
  52. {
  53. ProductionYear = yearInName;
  54. hasChanges = true;
  55. }
  56. else
  57. {
  58. // Try to get the year from the folder name
  59. if (!IsInMixedFolder)
  60. {
  61. info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
  62. yearInName = info.Year;
  63. if (yearInName.HasValue)
  64. {
  65. ProductionYear = yearInName;
  66. hasChanges = true;
  67. }
  68. }
  69. }
  70. }
  71. return hasChanges;
  72. }
  73. }
  74. }