2
0

Trailer.cs 3.3 KB

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