using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Controller.Entities { /// /// Class Video /// public class Video : BaseItem, IHasAspectRatio, IHasTags, ISupportsPlaceHolders, IHasMediaSources, IHasShortOverview, IHasPreferredMetadataLanguage, IThemeMedia { public Guid? PrimaryVersionId { get; set; } public List AdditionalParts { get; set; } public List LocalAlternateVersions { get; set; } public List LinkedAlternateVersions { get; set; } public bool IsThemeMedia { get; set; } public string FormatName { get; set; } public long? Size { get; set; } public string Container { get; set; } public int? TotalBitrate { get; set; } public string ShortOverview { get; set; } public ExtraType ExtraType { get; set; } /// /// Gets or sets the preferred metadata country code. /// /// The preferred metadata country code. public string PreferredMetadataCountryCode { get; set; } public string PreferredMetadataLanguage { get; set; } /// /// Gets or sets the timestamp. /// /// The timestamp. public TransportStreamTimestamp? Timestamp { get; set; } public Video() { PlayableStreamFileNames = new List(); AdditionalParts = new List(); LocalAlternateVersions = new List(); Tags = new List(); SubtitleFiles = new List(); LinkedAlternateVersions = new List(); } [IgnoreDataMember] public override bool SupportsAddingToPlaylist { get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; } } [IgnoreDataMember] public int MediaSourceCount { get { return LinkedAlternateVersions.Count + LocalAlternateVersions.Count + 1; } } [IgnoreDataMember] public bool IsStacked { get { return AdditionalParts.Count > 0; } } [IgnoreDataMember] public bool HasLocalAlternateVersions { get { return LocalAlternateVersions.Count > 0; } } public IEnumerable GetAdditionalPartIds() { return AdditionalParts.Select(i => LibraryManager.GetNewItemId(i, typeof(Video))); } public IEnumerable GetLocalAlternateVersionIds() { return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video))); } /// /// Gets the linked children. /// /// IEnumerable{BaseItem}. public IEnumerable