Trailer.cs 3.4 KB

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