using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Linq; namespace MediaBrowser.Controller.Entities { /// /// Class Trailer /// public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo { public List SoundtrackIds { get; set; } public string PreferredMetadataLanguage { get; set; } /// /// Gets or sets the preferred metadata country code. /// /// The preferred metadata country code. public string PreferredMetadataCountryCode { get; set; } public Trailer() { RemoteTrailers = new List(); Taglines = new List(); SoundtrackIds = new List(); LocalTrailerIds = new List(); Keywords = new List(); } public float? Metascore { get; set; } public List LocalTrailerIds { 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; } } public override string GetUserDataKey() { var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom); if (!string.IsNullOrWhiteSpace(key)) { key = key + "-trailer"; return key; } return base.GetUserDataKey(); } protected override bool GetBlockUnratedValue(UserConfiguration config) { return config.BlockUnratedItems.Contains(UnratedItem.Trailer); } public TrailerInfo GetLookupInfo() { var info = GetItemLookupInfo(); info.IsLocalTrailer = IsLocalTrailer; return info; } } }