| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 | using MediaBrowser.Model.Entities;using System.Collections.Generic;using System.IO;using System.Linq;using System.Runtime.Serialization;namespace MediaBrowser.Controller.Entities{    /// <summary>    /// Class Video    /// </summary>    public class Video : BaseItem, IHasMediaStreams    {        /// <summary>        /// Gets or sets the type of the video.        /// </summary>        /// <value>The type of the video.</value>        public VideoType VideoType { get; set; }        /// <summary>        /// Gets or sets the type of the iso.        /// </summary>        /// <value>The type of the iso.</value>        public IsoType? IsoType { get; set; }        /// <summary>        /// Gets or sets the format of the video.        /// </summary>        /// <value>The format of the video.</value>        public VideoFormat VideoFormat { get; set; }        /// <summary>        /// Gets or sets the media streams.        /// </summary>        /// <value>The media streams.</value>        public List<MediaStream> MediaStreams { get; set; }        /// <summary>        /// Gets or sets the chapters.        /// </summary>        /// <value>The chapters.</value>        public List<ChapterInfo> Chapters { get; set; }        /// <summary>        /// If the video is a folder-rip, this will hold the file list for the largest playlist        /// </summary>        public List<string> PlayableStreamFileNames { get; set; }        /// <summary>        /// Gets the playable stream files.        /// </summary>        /// <returns>List{System.String}.</returns>        public List<string> GetPlayableStreamFiles()        {            return GetPlayableStreamFiles(Path);        }                /// <summary>        /// Gets the playable stream files.        /// </summary>        /// <param name="rootPath">The root path.</param>        /// <returns>List{System.String}.</returns>        public List<string> GetPlayableStreamFiles(string rootPath)        {            if (PlayableStreamFileNames == null)            {                return null;            }            var allFiles = Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories).ToList();            return PlayableStreamFileNames.Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, System.StringComparison.OrdinalIgnoreCase)))                .Where(f => !string.IsNullOrEmpty(f))                .ToList();        }        /// <summary>        /// The default video stream for this video.  Use this to determine media info for this item.        /// </summary>        /// <value>The default video stream.</value>        [IgnoreDataMember]        public MediaStream DefaultVideoStream        {            get { return MediaStreams != null ? MediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video) : null; }        }        /// <summary>        /// Gets a value indicating whether [is3 D].        /// </summary>        /// <value><c>true</c> if [is3 D]; otherwise, <c>false</c>.</value>        [IgnoreDataMember]        public bool Is3D        {            get { return VideoFormat > 0; }        }        /// <summary>        /// Gets the type of the media.        /// </summary>        /// <value>The type of the media.</value>        public override string MediaType        {            get            {                return Model.Entities.MediaType.Video;            }        }    }}
 |