MusicVideo.cs 2.4 KB

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