Trailer.cs 3.5 KB

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