using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Library; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Sync; using System; using System.Collections.Generic; using System.Diagnostics; using MediaBrowser.Model.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. /// [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")] public class BaseItemDto : IHasProviderIds, IItemDto, IHasServerId, IHasSyncInfo { /// /// Gets or sets the name. /// /// The name. public string Name { get; set; } public string OriginalTitle { get; set; } /// /// Gets or sets the server identifier. /// /// The server identifier. public string ServerId { get; set; } /// /// Gets or sets the id. /// /// The id. public string Id { get; set; } /// /// Gets or sets the etag. /// /// The etag. public string Etag { get; set; } /// /// Gets or sets the type of the source. /// /// The type of the source. public string SourceType { get; set; } /// /// Gets or sets the playlist item identifier. /// /// The playlist item identifier. public string PlaylistItemId { get; set; } /// /// Gets or sets the date created. /// /// The date created. public DateTime? DateCreated { get; set; } public DateTime? DateLastMediaAdded { get; set; } public ExtraType? ExtraType { get; set; } public int? AirsBeforeSeasonNumber { get; set; } public int? AirsAfterSeasonNumber { get; set; } public int? AirsBeforeEpisodeNumber { get; set; } public int? AbsoluteEpisodeNumber { get; set; } public bool? DisplaySpecialsWithSeasons { get; set; } public bool? CanDelete { get; set; } public bool? CanDownload { get; set; } public bool? HasSubtitles { get; set; } public string PreferredMetadataLanguage { get; set; } public string PreferredMetadataCountryCode { get; set; } public string AwardSummary { get; set; } public float? Metascore { get; set; } /// /// Gets or sets a value indicating whether [supports synchronize]. /// /// null if [supports synchronize] contains no value, true if [supports synchronize]; otherwise, false. public bool? SupportsSync { get; set; } /// /// Gets or sets a value indicating whether this instance has synchronize job. /// /// null if [has synchronize job] contains no value, true if [has synchronize job]; otherwise, false. public bool? HasSyncJob { get; set; } /// /// Gets or sets a value indicating whether this instance is synced. /// /// null if [is synced] contains no value, true if [is synced]; otherwise, false. public bool? IsSynced { get; set; } /// /// Gets or sets the synchronize status. /// /// The synchronize status. public SyncJobItemStatus? SyncStatus { get; set; } /// /// Gets or sets the synchronize percent. /// /// The synchronize percent. public double? SyncPercent { get; set; } public string Container { get; set; } /// /// Gets or sets the DVD season number. /// /// The DVD season number. public int? DvdSeasonNumber { get; set; } /// /// Gets or sets the DVD episode number. /// /// The DVD episode number. public float? DvdEpisodeNumber { get; set; } /// /// Gets or sets the name of the sort. /// /// The name of the sort. public string SortName { get; set; } public string ForcedSortName { get; set; } /// /// Gets or sets the video3 D format. /// /// The video3 D format. public Video3DFormat? Video3DFormat { get; set; } /// /// Gets or sets the premiere date. /// /// The premiere date. public DateTime? PremiereDate { get; set; } /// /// Gets or sets the external urls. /// /// The external urls. public ExternalUrl[] ExternalUrls { get; set; } /// /// Gets or sets the media versions. /// /// The media versions. public List MediaSources { get; set; } /// /// Gets or sets the critic rating. /// /// The critic rating. public float? CriticRating { get; set; } /// /// Gets or sets the game system. /// /// The game system. public string GameSystem { get; set; } public string[] ProductionLocations { get; set; } /// /// Gets or sets the critic rating summary. /// /// The critic rating summary. public string CriticRatingSummary { get; set; } public List MultiPartGameFiles { get; set; } /// /// Gets or sets the path. /// /// The path. public string Path { get; set; } /// /// Gets or sets the official rating. /// /// The official rating. public string OfficialRating { get; set; } /// /// Gets or sets the custom rating. /// /// The custom rating. public string CustomRating { get; set; } /// /// Gets or sets the channel identifier. /// /// The channel identifier. public string ChannelId { get; set; } public string ChannelName { get; set; } public string ServiceName { get; set; } /// /// Gets or sets the overview. /// /// The overview. public string Overview { get; set; } /// /// Gets or sets the taglines. /// /// The taglines. public List Taglines { get; set; } /// /// Gets or sets the genres. /// /// The genres. public List Genres { get; set; } /// /// Gets or sets the series genres. /// /// The series genres. public List SeriesGenres { get; set; } /// /// Gets or sets the community rating. /// /// The community rating. public float? CommunityRating { get; set; } /// /// Gets or sets the vote count. /// /// The vote count. public int? VoteCount { get; set; } /// /// Gets or sets the cumulative run time ticks. /// /// The cumulative run time ticks. public long? CumulativeRunTimeTicks { get; set; } /// /// Gets or sets the original run time ticks. /// /// The original run time ticks. public long? OriginalRunTimeTicks { get; set; } /// /// Gets or sets the run time ticks. /// /// The run time ticks. public long? RunTimeTicks { get; set; } /// /// Gets or sets the play access. /// /// The play access. public PlayAccess? PlayAccess { get; set; } /// /// Gets or sets the aspect ratio. /// /// The aspect ratio. public string AspectRatio { get; set; } /// /// Gets or sets the production year. /// /// The production year. public int? ProductionYear { get; set; } /// /// Gets or sets the players supported by a game. /// /// The players. public int? Players { get; set; } /// /// Gets or sets a value indicating whether this instance is place holder. /// /// null if [is place holder] contains no value, true if [is place holder]; otherwise, false. public bool? IsPlaceHolder { get; set; } /// /// Gets or sets the number. /// /// The number. public string Number { get; set; } public string ChannelNumber { get; set; } /// /// Gets or sets the index number. /// /// The index number. public int? IndexNumber { get; set; } /// /// Gets or sets the index number end. /// /// The index number end. public int? IndexNumberEnd { get; set; } /// /// Gets or sets the parent index number. /// /// The parent index number. public int? ParentIndexNumber { get; set; } /// /// Gets or sets the trailer urls. /// /// The trailer urls. public List RemoteTrailers { get; set; } /// /// Gets or sets the provider ids. /// /// The provider ids. public Dictionary ProviderIds { get; set; } /// /// Gets or sets a value indicating whether this instance is HD. /// /// null if [is HD] contains no value, true if [is HD]; otherwise, false. public bool? IsHD { get; set; } /// /// Gets or sets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. public bool? IsFolder { get; set; } /// /// Gets or sets the parent id. /// /// The parent id. public string ParentId { get; set; } /// /// Gets or sets the type. /// /// The type. public string Type { get; set; } /// /// Gets or sets the people. /// /// The people. public BaseItemPerson[] People { get; set; } /// /// Gets or sets the studios. /// /// The studios. public StudioDto[] 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. 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. public string ParentBackdropItemId { get; set; } /// /// Gets or sets the parent backdrop image tags. /// /// The parent backdrop image tags. public List ParentBackdropImageTags { get; set; } /// /// Gets or sets the local trailer count. /// /// The local trailer count. public int? LocalTrailerCount { get; set; } /// /// User data for this item based on the user it's being requested for /// /// The user data. public UserItemDataDto UserData { get; set; } /// /// Gets or sets the recursive item count. /// /// The recursive item count. public int? RecursiveItemCount { get; set; } /// /// Gets or sets the child count. /// /// The child count. public int? ChildCount { get; set; } /// /// Gets or sets the name of the series. /// /// The name of the series. public string SeriesName { get; set; } /// /// Gets or sets the series id. /// /// The series id. public string SeriesId { get; set; } /// /// Gets or sets the season identifier. /// /// The season identifier. public string SeasonId { get; set; } /// /// Gets or sets the special feature count. /// /// The special feature count. public int? SpecialFeatureCount { get; set; } /// /// Gets or sets the display preferences id. /// /// The display preferences id. public string DisplayPreferencesId { get; set; } /// /// Gets or sets the status. /// /// The status. public string Status { get; set; } /// /// Gets or sets the air time. /// /// The air time. public string AirTime { get; set; } /// /// Gets or sets the air days. /// /// The air days. public List AirDays { get; set; } /// /// Gets or sets the tags. /// /// The tags. public List Tags { get; set; } /// /// Gets or sets the keywords. /// /// The keywords. public List Keywords { get; set; } /// /// Gets or sets the primary image aspect ratio, after image enhancements. /// /// The primary image aspect ratio. public double? PrimaryImageAspectRatio { get; set; } /// /// Gets or sets the artists. /// /// The artists. public List Artists { get; set; } /// /// Gets or sets the artist items. /// /// The artist items. public List ArtistItems { get; set; } /// /// Gets or sets the album. /// /// The album. public string Album { get; set; } /// /// Gets or sets the type of the collection. /// /// The type of the collection. public string CollectionType { get; set; } /// /// Gets or sets the display order. /// /// The display order. public string DisplayOrder { get; set; } /// /// Gets or sets the album id. /// /// The album id. public string AlbumId { get; set; } /// /// Gets or sets the album image tag. /// /// The album image tag. public string AlbumPrimaryImageTag { get; set; } /// /// Gets or sets the series primary image tag. /// /// The series primary image tag. public string SeriesPrimaryImageTag { get; set; } /// /// Gets or sets the album artist. /// /// The album artist. public string AlbumArtist { get; set; } /// /// Gets or sets the album artists. /// /// The album artists. public List AlbumArtists { get; set; } /// /// Gets or sets the name of the season. /// /// The name of the season. public string SeasonName { get; set; } /// /// Gets or sets the media streams. /// /// The media streams. public List MediaStreams { get; set; } /// /// Gets or sets the type of the video. /// /// The type of the video. public VideoType? VideoType { get; set; } /// /// Gets or sets the display type of the media. /// /// The display type of the media. public string DisplayMediaType { get; set; } /// /// Gets or sets the part count. /// /// The part count. public int? PartCount { get; set; } public int? MediaSourceCount { 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 StringHelper.EqualsIgnoreCase(Type, type); } /// /// Gets or sets the image tags. /// /// The image tags. public Dictionary ImageTags { get; set; } /// /// Gets or sets the backdrop image tags. /// /// The backdrop image tags. public List BackdropImageTags { get; set; } /// /// Gets or sets the screenshot image tags. /// /// The screenshot image tags. public List ScreenshotImageTags { get; set; } /// /// Gets or sets the parent logo image tag. /// /// The parent logo image tag. public string ParentLogoImageTag { get; set; } /// /// If the item does not have a art, this will hold the Id of the Parent that has one. /// /// The parent art item id. public string ParentArtItemId { get; set; } /// /// Gets or sets the parent art image tag. /// /// The parent art image tag. public string ParentArtImageTag { get; set; } /// /// Gets or sets the series thumb image tag. /// /// The series thumb image tag. public string SeriesThumbImageTag { get; set; } /// /// Gets or sets the series studio. /// /// The series studio. public string SeriesStudio { get; set; } public StudioDto SeriesStudioInfo { get; set; } /// /// Gets or sets the parent thumb item id. /// /// The parent thumb item id. public string ParentThumbItemId { get; set; } /// /// Gets or sets the parent thumb image tag. /// /// The parent thumb image tag. public string ParentThumbImageTag { get; set; } /// /// Gets or sets the parent primary image item identifier. /// /// The parent primary image item identifier. public string ParentPrimaryImageItemId { get; set; } /// /// Gets or sets the parent primary image tag. /// /// The parent primary image tag. public string ParentPrimaryImageTag { get; set; } /// /// Gets or sets the chapters. /// /// The chapters. public List Chapters { get; set; } /// /// Gets or sets the type of the location. /// /// The type of the location. public LocationType? LocationType { get; set; } /// /// Gets or sets the type of the iso. /// /// The type of the iso. public IsoType? IsoType { get; set; } /// /// Gets or sets the type of the media. /// /// The type of the media. public string MediaType { get; set; } /// /// Gets or sets the end date. /// /// The end date. public DateTime? EndDate { get; set; } /// /// Gets or sets the home page URL. /// /// The home page URL. public string HomePageUrl { get; set; } /// /// Gets or sets the locked fields. /// /// The locked fields. public List LockedFields { get; set; } /// /// Gets or sets the trailer count. /// /// The trailer count. public int? TrailerCount { get; set; } /// /// Gets or sets the movie count. /// /// The movie count. public int? MovieCount { get; set; } /// /// Gets or sets the series count. /// /// The series count. public int? SeriesCount { get; set; } public int? ProgramCount { get; set; } /// /// Gets or sets the episode count. /// /// The episode count. public int? EpisodeCount { get; set; } /// /// Gets or sets the game count. /// /// The game count. public int? GameCount { get; set; } /// /// Gets or sets the song count. /// /// The song count. public int? SongCount { get; set; } /// /// Gets or sets the album count. /// /// The album count. public int? AlbumCount { get; set; } public int? ArtistCount { get; set; } /// /// Gets or sets the music video count. /// /// The music video count. public int? MusicVideoCount { get; set; } /// /// Gets or sets a value indicating whether [enable internet providers]. /// /// true if [enable internet providers]; otherwise, false. public bool? LockData { get; set; } public int? Width { get; set; } public int? Height { get; set; } public string CameraMake { get; set; } public string CameraModel { get; set; } public string Software { get; set; } public double? ExposureTime { get; set; } public double? FocalLength { get; set; } public ImageOrientation? ImageOrientation { get; set; } public double? Aperture { get; set; } public double? ShutterSpeed { get; set; } public double? Latitude { get; set; } public double? Longitude { get; set; } public double? Altitude { get; set; } public int? IsoSpeedRating { get; set; } /// /// Used by RecordingGroup /// public int? RecordingCount { get; set; } /// /// Gets or sets the series timer identifier. /// /// The series timer identifier. public string SeriesTimerId { get; set; } /// /// 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 thumb. /// /// true if this instance has thumb; otherwise, false. [IgnoreDataMember] public bool HasBackdrop { get { return (BackdropImageTags != null && BackdropImageTags.Count > 0) || (ParentBackdropImageTags != null && ParentBackdropImageTags.Count > 0); } } /// /// 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 is video. /// /// true if this instance is video; otherwise, false. [IgnoreDataMember] public bool IsVideo { get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); } } /// /// Gets a value indicating whether this instance is audio. /// /// true if this instance is audio; otherwise, false. [IgnoreDataMember] public bool IsAudio { get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); } } /// /// Gets a value indicating whether this instance is game. /// /// true if this instance is game; otherwise, false. [IgnoreDataMember] public bool IsGame { get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); } } /// /// Gets a value indicating whether this instance is person. /// /// true if this instance is person; otherwise, false. [IgnoreDataMember] public bool IsPerson { get { return StringHelper.EqualsIgnoreCase(Type, "Person"); } } [IgnoreDataMember] public bool IsMusicGenre { get { return StringHelper.EqualsIgnoreCase(Type, "MusicGenre"); } } [IgnoreDataMember] public bool IsGameGenre { get { return StringHelper.EqualsIgnoreCase(Type, "GameGenre"); } } [IgnoreDataMember] public bool IsGenre { get { return StringHelper.EqualsIgnoreCase(Type, "Genre"); } } [IgnoreDataMember] public bool IsArtist { get { return StringHelper.EqualsIgnoreCase(Type, "MusicArtist"); } } [IgnoreDataMember] public bool IsAlbum { get { return StringHelper.EqualsIgnoreCase(Type, "MusicAlbum"); } } [IgnoreDataMember] public bool IsStudio { get { return StringHelper.EqualsIgnoreCase(Type, "Studio"); } } /// /// Gets or sets the program identifier. /// /// The program identifier. public string ProgramId { get; set; } /// /// Gets or sets the channel primary image tag. /// /// The channel primary image tag. public string ChannelPrimaryImageTag { get; set; } /// /// The start date of the recording, in UTC. /// public DateTime? StartDate { get; set; } /// /// Gets or sets the completion percentage. /// /// The completion percentage. public double? CompletionPercentage { get; set; } /// /// Gets or sets a value indicating whether this instance is repeat. /// /// true if this instance is repeat; otherwise, false. public bool? IsRepeat { get; set; } /// /// Gets or sets the episode title. /// /// The episode title. public string EpisodeTitle { get; set; } /// /// Gets or sets the type of the channel. /// /// The type of the channel. public ChannelType? ChannelType { get; set; } /// /// Gets or sets the audio. /// /// The audio. public ProgramAudio? Audio { get; set; } /// /// Gets or sets a value indicating whether this instance is movie. /// /// true if this instance is movie; otherwise, false. public bool? IsMovie { get; set; } /// /// Gets or sets a value indicating whether this instance is sports. /// /// true if this instance is sports; otherwise, false. public bool? IsSports { get; set; } /// /// Gets or sets a value indicating whether this instance is series. /// /// true if this instance is series; otherwise, false. public bool? IsSeries { get; set; } /// /// Gets or sets a value indicating whether this instance is live. /// /// true if this instance is live; otherwise, false. public bool? IsLive { get; set; } /// /// Gets or sets a value indicating whether this instance is news. /// /// true if this instance is news; otherwise, false. public bool? IsNews { get; set; } /// /// Gets or sets a value indicating whether this instance is kids. /// /// true if this instance is kids; otherwise, false. public bool? IsKids { get; set; } /// /// Gets or sets a value indicating whether this instance is premiere. /// /// true if this instance is premiere; otherwise, false. public bool? IsPremiere { get; set; } /// /// Gets or sets the timer identifier. /// /// The timer identifier. public string TimerId { get; set; } /// /// Gets or sets the current program. /// /// The current program. public BaseItemDto CurrentProgram { get; set; } } }