using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities { /// /// Class Trailer /// [Obsolete] public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo { public List ProductionLocations { get; set; } public Trailer() { RemoteTrailers = new List(); Taglines = new List(); Keywords = new List(); ProductionLocations = new List(); } public float? Metascore { get; set; } public List RemoteTrailers { get; set; } public List Keywords { get; set; } /// /// Gets or sets the taglines. /// /// The taglines. public List Taglines { get; set; } /// /// Gets or sets the budget. /// /// The budget. public double? Budget { get; set; } /// /// Gets or sets the revenue. /// /// The revenue. public double? Revenue { get; set; } /// /// Gets or sets the critic rating. /// /// The critic rating. public float? CriticRating { get; set; } /// /// Gets or sets the critic rating summary. /// /// The critic rating summary. public string CriticRatingSummary { get; set; } /// /// Gets a value indicating whether this instance is local trailer. /// /// true if this instance is local trailer; otherwise, false. [IgnoreDataMember] public bool IsLocalTrailer { get { // Local trailers are not part of children return Parent == null; } } protected override string CreateUserDataKey() { var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb); if (!string.IsNullOrWhiteSpace(key)) { key = key + "-trailer"; // Make sure different trailers have their own data. if (RunTimeTicks.HasValue) { key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture); } return key; } return base.CreateUserDataKey(); } protected override bool GetBlockUnratedValue(UserPolicy config) { return config.BlockUnratedItems.Contains(UnratedItem.Trailer); } public TrailerInfo GetLookupInfo() { var info = GetItemLookupInfo(); info.IsLocalTrailer = IsLocalTrailer; return info; } } }