using System.ComponentModel; using MediaBrowser.Model.Entities; using ProtoBuf; using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace MediaBrowser.Model.Dto { /// /// This is strictly used as a data transfer object from the api layer. /// This holds information about a BaseItem in a format that is convenient for the client. /// [ProtoContract] public class BaseItemDto : IHasProviderIds, INotifyPropertyChanged, IItemDto { /// /// Gets or sets the name. /// /// The name. [ProtoMember(1)] public string Name { get; set; } /// /// Gets or sets the id. /// /// The id. [ProtoMember(2)] public string Id { get; set; } /// /// Gets or sets the date created. /// /// The date created. [ProtoMember(3)] public DateTime? DateCreated { get; set; } /// /// Gets or sets the name of the sort. /// /// The name of the sort. [ProtoMember(4)] public string SortName { get; set; } /// /// Gets or sets the premiere date. /// /// The premiere date. [ProtoMember(5)] public DateTime? PremiereDate { get; set; } /// /// Gets or sets the path. /// /// The path. [ProtoMember(6)] public string Path { get; set; } /// /// Gets or sets the official rating. /// /// The official rating. [ProtoMember(7)] public string OfficialRating { get; set; } /// /// Gets or sets the overview. /// /// The overview. [ProtoMember(8)] public string Overview { get; set; } /// /// Gets or sets the taglines. /// /// The taglines. [ProtoMember(9)] public List Taglines { get; set; } /// /// Gets or sets the genres. /// /// The genres. [ProtoMember(10)] public List Genres { get; set; } /// /// Gets or sets the community rating. /// /// The community rating. [ProtoMember(11)] public float? CommunityRating { get; set; } /// /// Gets or sets the run time ticks. /// /// The run time ticks. [ProtoMember(12)] public long? RunTimeTicks { get; set; } /// /// Gets or sets the aspect ratio. /// /// The aspect ratio. [ProtoMember(13)] public string AspectRatio { get; set; } /// /// Gets or sets the production year. /// /// The production year. [ProtoMember(14)] public int? ProductionYear { get; set; } /// /// Gets or sets the index number. /// /// The index number. [ProtoMember(15)] public int? IndexNumber { get; set; } /// /// Gets or sets the parent index number. /// /// The parent index number. [ProtoMember(16)] public int? ParentIndexNumber { get; set; } /// /// Gets or sets the trailer urls. /// /// The trailer urls. [ProtoMember(17)] public List TrailerUrls { get; set; } /// /// Gets or sets the provider ids. /// /// The provider ids. [ProtoMember(18)] public Dictionary ProviderIds { get; set; } /// /// Gets or sets the language. /// /// The language. [ProtoMember(24)] public string Language { get; set; } /// /// Gets or sets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. [ProtoMember(25)] public bool IsFolder { get; set; } /// /// Gets or sets the parent id. /// /// The parent id. [ProtoMember(28)] public string ParentId { get; set; } /// /// Gets or sets the type. /// /// The type. [ProtoMember(29)] public string Type { get; set; } /// /// Gets or sets the people. /// /// The people. [ProtoMember(30)] public BaseItemPerson[] People { get; set; } /// /// Gets or sets the studios. /// /// The studios. [ProtoMember(31)] public List Studios { get; set; } /// /// If the item does not have a logo, this will hold the Id of the Parent that has one. /// /// The parent logo item id. [ProtoMember(32)] public string ParentLogoItemId { get; set; } /// /// If the item does not have any backdrops, this will hold the Id of the Parent that has one. /// /// The parent backdrop item id. [ProtoMember(33)] public string ParentBackdropItemId { get; set; } /// /// Gets or sets the parent backdrop image tags. /// /// The parent backdrop image tags. [ProtoMember(34)] public List ParentBackdropImageTags { get; set; } /// /// Gets or sets the local trailer count. /// /// The local trailer count. [ProtoMember(35)] public int? LocalTrailerCount { get; set; } /// /// User data for this item based on the user it's being requested for /// /// The user data. [ProtoMember(36)] public UserItemDataDto UserData { get; set; } /// /// Gets or sets the recently added item count. /// /// The recently added item count. [ProtoMember(38)] public int? RecentlyAddedItemCount { get; set; } /// /// Gets or sets the played percentage. /// /// The played percentage. [ProtoMember(41)] public double? PlayedPercentage { get; set; } /// /// Gets or sets the recursive item count. /// /// The recursive item count. [ProtoMember(42)] public int? RecursiveItemCount { get; set; } /// /// Gets or sets the child count. /// /// The child count. [ProtoMember(44)] public int? ChildCount { get; set; } /// /// Gets or sets the name of the series. /// /// The name of the series. [ProtoMember(45)] public string SeriesName { get; set; } /// /// Gets or sets the series id. /// /// The series id. [ProtoMember(46)] public string SeriesId { get; set; } /// /// Gets or sets the special feature count. /// /// The special feature count. [ProtoMember(48)] public int? SpecialFeatureCount { get; set; } /// /// Gets or sets the display preferences id. /// /// The display preferences id. [ProtoMember(49)] public string DisplayPreferencesId { get; set; } /// /// Gets or sets the status. /// /// The status. [ProtoMember(50)] public SeriesStatus? Status { get; set; } /// /// Gets or sets the air time. /// /// The air time. [ProtoMember(51)] public string AirTime { get; set; } /// /// Gets or sets the air days. /// /// The air days. [ProtoMember(52)] public List AirDays { get; set; } /// /// Gets or sets the index options. /// /// The index options. [ProtoMember(54)] public string[] IndexOptions { get; set; } /// /// Gets or sets the primary image aspect ratio. /// /// The primary image aspect ratio. [ProtoMember(55)] public double? PrimaryImageAspectRatio { get; set; } /// /// Gets or sets the artist. /// /// The artist. [ProtoMember(56)] public string Artist { get; set; } /// /// Gets or sets the album. /// /// The album. [ProtoMember(57)] public string Album { get; set; } /// /// Gets or sets the album artist. /// /// The album artist. [ProtoMember(58)] public string AlbumArtist { get; set; } /// /// Gets or sets the media streams. /// /// The media streams. [ProtoMember(59)] public List MediaStreams { get; set; } /// /// Gets or sets the type of the video. /// /// The type of the video. [ProtoMember(60)] public VideoType? VideoType { get; set; } /// /// Gets or sets the display type of the media. /// /// The display type of the media. [ProtoMember(61)] public string DisplayMediaType { get; set; } /// /// Determines whether the specified type is type. /// /// The type. /// true if the specified type is type; otherwise, false. public bool IsType(Type type) { return IsType(type.Name); } /// /// Determines whether the specified type is type. /// /// The type. /// true if the specified type is type; otherwise, false. public bool IsType(string type) { return Type.Equals(type, StringComparison.OrdinalIgnoreCase); } /// /// Gets or sets the image tags. /// /// The image tags. [ProtoMember(62)] public Dictionary ImageTags { get; set; } /// /// Gets or sets the backdrop image tags. /// /// The backdrop image tags. [ProtoMember(63)] public List BackdropImageTags { get; set; } /// /// Gets or sets the parent logo image tag. /// /// The parent logo image tag. [ProtoMember(64)] public Guid? ParentLogoImageTag { get; set; } /// /// Gets or sets the chapters. /// /// The chapters. [ProtoMember(65)] public List Chapters { get; set; } /// /// Gets or sets the video format. /// /// The video format. [ProtoMember(66)] public VideoFormat? VideoFormat { get; set; } /// /// Gets or sets the type of the location. /// /// The type of the location. [ProtoMember(67)] public LocationType LocationType { get; set; } /// /// Gets or sets the type of the iso. /// /// The type of the iso. [ProtoMember(68)] public IsoType? IsoType { get; set; } /// /// Gets or sets the type of the media. /// /// The type of the media. [ProtoMember(69)] public string MediaType { get; set; } /// /// Gets or sets the overview HTML. /// /// The overview HTML. [ProtoMember(70)] public string OverviewHtml { get; set; } /// /// Gets a value indicating whether this instance can resume. /// /// true if this instance can resume; otherwise, false. [IgnoreDataMember] public bool CanResume { get { return UserData != null && UserData.PlaybackPositionTicks > 0; } } /// /// Gets the resume position ticks. /// /// The resume position ticks. [IgnoreDataMember] public long ResumePositionTicks { get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; } } /// /// Gets the backdrop count. /// /// The backdrop count. [IgnoreDataMember] public int BackdropCount { get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; } } /// /// Gets a value indicating whether this instance has banner. /// /// true if this instance has banner; otherwise, false. [IgnoreDataMember] public bool HasBanner { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); } } /// /// Gets a value indicating whether this instance has art. /// /// true if this instance has art; otherwise, false. [IgnoreDataMember] public bool HasArtImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Art); } } /// /// Gets a value indicating whether this instance has logo. /// /// true if this instance has logo; otherwise, false. [IgnoreDataMember] public bool HasLogo { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Logo); } } /// /// Gets a value indicating whether this instance has thumb. /// /// true if this instance has thumb; otherwise, false. [IgnoreDataMember] public bool HasThumb { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Thumb); } } /// /// Gets a value indicating whether this instance has primary image. /// /// true if this instance has primary image; otherwise, false. [IgnoreDataMember] public bool HasPrimaryImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); } } /// /// Gets a value indicating whether this instance has disc image. /// /// true if this instance has disc image; otherwise, false. [IgnoreDataMember] public bool HasDiscImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); } } /// /// Gets a value indicating whether this instance has box image. /// /// true if this instance has box image; otherwise, false. [IgnoreDataMember] public bool HasBoxImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); } } /// /// Gets a value indicating whether this instance has menu image. /// /// true if this instance has menu image; otherwise, false. [IgnoreDataMember] public bool HasMenuImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); } } /// /// Gets a value indicating whether this instance is video. /// /// true if this instance is video; otherwise, false. [IgnoreDataMember] public bool HasTrailer { get { return LocalTrailerCount > 0 || (TrailerUrls != null && TrailerUrls.Count > 0); } } /// /// Gets a value indicating whether this instance is video. /// /// true if this instance is video; otherwise, false. [IgnoreDataMember] public bool IsVideo { get { return string.Equals(MediaType, Entities.MediaType.Video, StringComparison.OrdinalIgnoreCase); } } /// /// Gets a value indicating whether this instance is audio. /// /// true if this instance is audio; otherwise, false. [IgnoreDataMember] public bool IsAudio { get { return string.Equals(MediaType, Entities.MediaType.Audio, StringComparison.OrdinalIgnoreCase); } } /// /// Gets a value indicating whether this instance is game. /// /// true if this instance is game; otherwise, false. [IgnoreDataMember] public bool IsGame { get { return string.Equals(MediaType, Entities.MediaType.Game, StringComparison.OrdinalIgnoreCase); } } /// /// Gets a value indicating whether this instance is person. /// /// true if this instance is person; otherwise, false. [IgnoreDataMember] public bool IsPerson { get { return string.Equals(Type, "Person", StringComparison.OrdinalIgnoreCase); } } /// /// Gets a value indicating whether this instance is root. /// /// true if this instance is root; otherwise, false. [IgnoreDataMember] public bool IsRoot { get { return string.Equals(Type, "AggregateFolder", StringComparison.OrdinalIgnoreCase); } } /// /// Occurs when [property changed]. /// public event PropertyChangedEventHandler PropertyChanged; } }