2
0

Trailer.cs 3.4 KB

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