Trailer.cs 3.5 KB

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