using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Library; using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; 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. /// [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")] public class BaseItemDto : IHasProviderIds, IHasPropertyChangedEvent, IItemDto, IHasServerId { /// /// Gets or sets the name. /// /// The name. public string Name { 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 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 string PreferredMetadataLanguage { get; set; } public string PreferredMetadataCountryCode { get; set; } public string AwardSummary { get; set; } public float? Metascore { get; set; } public bool? IsUnidentified { get; set; } public bool? HasDynamicCategories { get; set; } public int? AnimeSeriesIndex { get; set; } public bool? SupportsSync { get; set; } public bool? HasSyncJob { 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; } /// /// 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; } /// /// Gets or sets the overview. /// /// The overview. public string Overview { get; set; } /// /// Gets or sets the short overview. /// /// The short overview. public string ShortOverview { get; set; } /// /// Gets or sets the name of the TMDB collection. /// /// The name of the TMDB collection. public string TmdbCollectionName { 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 season count. /// /// The season count. public int? SeasonCount { 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 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 soundtrack ids. /// /// The soundtrack ids. public string[] SoundtrackIds { 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 season user data. /// /// The season user data. public UserItemDataDto SeasonUserData { 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 SeriesStatus? 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 index options. /// /// The index options. public string[] IndexOptions { 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 primary image aspect ratio, before image enhancements. /// /// The original primary image aspect ratio. public double? OriginalPrimaryImageAspectRatio { get; set; } /// /// Gets or sets the artists. /// /// The artists. public List Artists { 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 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); } /// /// Gets or sets a value indicating whether [supports playlists]. /// /// true if [supports playlists]; otherwise, false. public bool SupportsPlaylists { get { return RunTimeTicks.HasValue || IsFolder || IsGenre || IsMusicGenre || IsArtist; } } /// /// 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; } /// /// 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 production locations. /// /// The production locations. public List ProductionLocations { 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 locked fields. /// /// The locked fields. public List LockedFields { 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; } /// /// 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; } /// /// 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; } /// /// 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 the screenshot count. /// /// The screenshot count. [IgnoreDataMember] public int ScreenshotCount { get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.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 box image. /// /// true if this instance has box image; otherwise, false. [IgnoreDataMember] public bool HasBoxRearImage { get { return ImageTags != null && ImageTags.ContainsKey(ImageType.BoxRear); } } /// /// 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 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"); } } /// /// Gets a value indicating whether this instance is root. /// /// true if this instance is root; otherwise, false. [IgnoreDataMember] public bool IsRoot { get { return StringHelper.EqualsIgnoreCase(Type, "AggregateFolder"); } } [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"); } } /// /// Occurs when [property changed]. /// public event PropertyChangedEventHandler PropertyChanged; } }