Trailer.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using MediaBrowser.Controller.Providers;
  2. using MediaBrowser.Model.Configuration;
  3. using MediaBrowser.Model.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.Serialization;
  7. using System.Linq;
  8. namespace MediaBrowser.Controller.Entities
  9. {
  10. /// <summary>
  11. /// Class Trailer
  12. /// </summary>
  13. public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
  14. {
  15. public List<Guid> SoundtrackIds { get; set; }
  16. public string PreferredMetadataLanguage { get; set; }
  17. /// <summary>
  18. /// Gets or sets the preferred metadata country code.
  19. /// </summary>
  20. /// <value>The preferred metadata country code.</value>
  21. public string PreferredMetadataCountryCode { get; set; }
  22. public Trailer()
  23. {
  24. RemoteTrailers = new List<MediaUrl>();
  25. Taglines = new List<string>();
  26. SoundtrackIds = new List<Guid>();
  27. LocalTrailerIds = new List<Guid>();
  28. Keywords = new List<string>();
  29. }
  30. public float? Metascore { get; set; }
  31. public List<Guid> LocalTrailerIds { get; set; }
  32. public List<MediaUrl> RemoteTrailers { get; set; }
  33. public List<string> Keywords { get; set; }
  34. /// <summary>
  35. /// Gets or sets the taglines.
  36. /// </summary>
  37. /// <value>The taglines.</value>
  38. public List<string> Taglines { get; set; }
  39. /// <summary>
  40. /// Gets or sets the budget.
  41. /// </summary>
  42. /// <value>The budget.</value>
  43. public double? Budget { get; set; }
  44. /// <summary>
  45. /// Gets or sets the revenue.
  46. /// </summary>
  47. /// <value>The revenue.</value>
  48. public double? Revenue { get; set; }
  49. /// <summary>
  50. /// Gets or sets the critic rating.
  51. /// </summary>
  52. /// <value>The critic rating.</value>
  53. public float? CriticRating { get; set; }
  54. /// <summary>
  55. /// Gets or sets the critic rating summary.
  56. /// </summary>
  57. /// <value>The critic rating summary.</value>
  58. public string CriticRatingSummary { get; set; }
  59. /// <summary>
  60. /// Gets a value indicating whether this instance is local trailer.
  61. /// </summary>
  62. /// <value><c>true</c> if this instance is local trailer; otherwise, <c>false</c>.</value>
  63. [IgnoreDataMember]
  64. public bool IsLocalTrailer
  65. {
  66. get
  67. {
  68. // Local trailers are not part of children
  69. return Parent == null;
  70. }
  71. }
  72. public override string GetUserDataKey()
  73. {
  74. var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom);
  75. if (!string.IsNullOrWhiteSpace(key))
  76. {
  77. return key + "-trailer";
  78. }
  79. return base.GetUserDataKey();
  80. }
  81. protected override bool GetBlockUnratedValue(UserConfiguration config)
  82. {
  83. return config.BlockUnratedItems.Contains(UnratedItem.Trailer);
  84. }
  85. public TrailerInfo GetLookupInfo()
  86. {
  87. var info = GetItemLookupInfo<TrailerInfo>();
  88. info.IsLocalTrailer = IsLocalTrailer;
  89. return info;
  90. }
  91. }
  92. }