Trailer.cs 3.4 KB

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