From a86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Thu, 27 Dec 2018 18:27:57 -0500 Subject: Add GPL modules --- MediaBrowser.Model/Entities/ChapterInfo.cs | 31 ++ MediaBrowser.Model/Entities/CollectionType.cs | 58 +++ MediaBrowser.Model/Entities/DisplayPreferences.cs | 99 +++++ MediaBrowser.Model/Entities/EmptyRequestResult.cs | 7 + MediaBrowser.Model/Entities/ExtraType.cs | 16 + MediaBrowser.Model/Entities/IHasProviderIds.cs | 16 + MediaBrowser.Model/Entities/ImageType.cs | 58 +++ MediaBrowser.Model/Entities/IsoType.cs | 17 + MediaBrowser.Model/Entities/LibraryUpdateInfo.cs | 62 +++ MediaBrowser.Model/Entities/LocationType.cs | 26 ++ .../Entities/MBRegistrationRecord.cs | 14 + MediaBrowser.Model/Entities/MediaStream.cs | 475 +++++++++++++++++++++ MediaBrowser.Model/Entities/MediaStreamType.cs | 25 ++ MediaBrowser.Model/Entities/MediaType.cs | 30 ++ MediaBrowser.Model/Entities/MediaUrl.cs | 9 + MediaBrowser.Model/Entities/MetadataFields.cs | 46 ++ MediaBrowser.Model/Entities/MetadataProviders.cs | 41 ++ MediaBrowser.Model/Entities/PackageReviewInfo.cs | 38 ++ MediaBrowser.Model/Entities/ParentalRating.cs | 32 ++ MediaBrowser.Model/Entities/PersonType.cs | 42 ++ MediaBrowser.Model/Entities/PluginSecurityInfo.cs | 21 + .../Entities/ProviderIdsExtensions.cs | 103 +++++ MediaBrowser.Model/Entities/ScrollDirection.cs | 17 + MediaBrowser.Model/Entities/SeriesStatus.cs | 18 + MediaBrowser.Model/Entities/SortOrder.cs | 17 + MediaBrowser.Model/Entities/TrailerType.cs | 11 + MediaBrowser.Model/Entities/UserDataSaveReason.cs | 34 ++ MediaBrowser.Model/Entities/Video3DFormat.cs | 12 + MediaBrowser.Model/Entities/VideoType.cs | 26 ++ MediaBrowser.Model/Entities/VirtualFolderInfo.cs | 55 +++ 30 files changed, 1456 insertions(+) create mode 100644 MediaBrowser.Model/Entities/ChapterInfo.cs create mode 100644 MediaBrowser.Model/Entities/CollectionType.cs create mode 100644 MediaBrowser.Model/Entities/DisplayPreferences.cs create mode 100644 MediaBrowser.Model/Entities/EmptyRequestResult.cs create mode 100644 MediaBrowser.Model/Entities/ExtraType.cs create mode 100644 MediaBrowser.Model/Entities/IHasProviderIds.cs create mode 100644 MediaBrowser.Model/Entities/ImageType.cs create mode 100644 MediaBrowser.Model/Entities/IsoType.cs create mode 100644 MediaBrowser.Model/Entities/LibraryUpdateInfo.cs create mode 100644 MediaBrowser.Model/Entities/LocationType.cs create mode 100644 MediaBrowser.Model/Entities/MBRegistrationRecord.cs create mode 100644 MediaBrowser.Model/Entities/MediaStream.cs create mode 100644 MediaBrowser.Model/Entities/MediaStreamType.cs create mode 100644 MediaBrowser.Model/Entities/MediaType.cs create mode 100644 MediaBrowser.Model/Entities/MediaUrl.cs create mode 100644 MediaBrowser.Model/Entities/MetadataFields.cs create mode 100644 MediaBrowser.Model/Entities/MetadataProviders.cs create mode 100644 MediaBrowser.Model/Entities/PackageReviewInfo.cs create mode 100644 MediaBrowser.Model/Entities/ParentalRating.cs create mode 100644 MediaBrowser.Model/Entities/PersonType.cs create mode 100644 MediaBrowser.Model/Entities/PluginSecurityInfo.cs create mode 100644 MediaBrowser.Model/Entities/ProviderIdsExtensions.cs create mode 100644 MediaBrowser.Model/Entities/ScrollDirection.cs create mode 100644 MediaBrowser.Model/Entities/SeriesStatus.cs create mode 100644 MediaBrowser.Model/Entities/SortOrder.cs create mode 100644 MediaBrowser.Model/Entities/TrailerType.cs create mode 100644 MediaBrowser.Model/Entities/UserDataSaveReason.cs create mode 100644 MediaBrowser.Model/Entities/Video3DFormat.cs create mode 100644 MediaBrowser.Model/Entities/VideoType.cs create mode 100644 MediaBrowser.Model/Entities/VirtualFolderInfo.cs (limited to 'MediaBrowser.Model/Entities') diff --git a/MediaBrowser.Model/Entities/ChapterInfo.cs b/MediaBrowser.Model/Entities/ChapterInfo.cs new file mode 100644 index 0000000000..c24ca553b5 --- /dev/null +++ b/MediaBrowser.Model/Entities/ChapterInfo.cs @@ -0,0 +1,31 @@ +using System; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class ChapterInfo + /// + public class ChapterInfo + { + /// + /// Gets or sets the start position ticks. + /// + /// The start position ticks. + public long StartPositionTicks { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the image path. + /// + /// The image path. + public string ImagePath { get; set; } + public DateTime ImageDateModified { get; set; } + + public string ImageTag { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs new file mode 100644 index 0000000000..f49e73c168 --- /dev/null +++ b/MediaBrowser.Model/Entities/CollectionType.cs @@ -0,0 +1,58 @@ +namespace MediaBrowser.Model.Entities +{ + public static class CollectionType + { + public const string Movies = "movies"; + + public const string TvShows = "tvshows"; + + public const string Music = "music"; + + public const string MusicVideos = "musicvideos"; + + public const string Trailers = "trailers"; + + public const string HomeVideos = "homevideos"; + + public const string BoxSets = "boxsets"; + + public const string Books = "books"; + public const string Photos = "photos"; + public const string Games = "games"; + public const string LiveTv = "livetv"; + public const string Playlists = "playlists"; + public const string Folders = "folders"; + } + + public static class SpecialFolder + { + public const string TvShowSeries = "TvShowSeries"; + public const string TvGenres = "TvGenres"; + public const string TvGenre = "TvGenre"; + public const string TvLatest = "TvLatest"; + public const string TvNextUp = "TvNextUp"; + public const string TvResume = "TvResume"; + public const string TvFavoriteSeries = "TvFavoriteSeries"; + public const string TvFavoriteEpisodes = "TvFavoriteEpisodes"; + + public const string MovieLatest = "MovieLatest"; + public const string MovieResume = "MovieResume"; + public const string MovieMovies = "MovieMovies"; + public const string MovieCollections = "MovieCollections"; + public const string MovieFavorites = "MovieFavorites"; + public const string MovieGenres = "MovieGenres"; + public const string MovieGenre = "MovieGenre"; + + public const string MusicArtists = "MusicArtists"; + public const string MusicAlbumArtists = "MusicAlbumArtists"; + public const string MusicAlbums = "MusicAlbums"; + public const string MusicGenres = "MusicGenres"; + public const string MusicLatest = "MusicLatest"; + public const string MusicPlaylists = "MusicPlaylists"; + public const string MusicSongs = "MusicSongs"; + public const string MusicFavorites = "MusicFavorites"; + public const string MusicFavoriteArtists = "MusicFavoriteArtists"; + public const string MusicFavoriteAlbums = "MusicFavoriteAlbums"; + public const string MusicFavoriteSongs = "MusicFavoriteSongs"; + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs new file mode 100644 index 0000000000..dc386f7753 --- /dev/null +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -0,0 +1,99 @@ +using MediaBrowser.Model.Drawing; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Defines the display preferences for any item that supports them (usually Folders) + /// + public class DisplayPreferences + { + /// + /// The image scale + /// + private const double ImageScale = .9; + + /// + /// Initializes a new instance of the class. + /// + public DisplayPreferences() + { + RememberIndexing = false; + PrimaryImageHeight = 250; + PrimaryImageWidth = 250; + ShowBackdrop = true; + CustomPrefs = new Dictionary(); + } + + /// + /// Gets or sets the user id. + /// + /// The user id. + public string Id { get; set; } + /// + /// Gets or sets the type of the view. + /// + /// The type of the view. + public string ViewType { get; set; } + /// + /// Gets or sets the sort by. + /// + /// The sort by. + public string SortBy { get; set; } + /// + /// Gets or sets the index by. + /// + /// The index by. + public string IndexBy { get; set; } + /// + /// Gets or sets a value indicating whether [remember indexing]. + /// + /// true if [remember indexing]; otherwise, false. + public bool RememberIndexing { get; set; } + /// + /// Gets or sets the height of the primary image. + /// + /// The height of the primary image. + public int PrimaryImageHeight { get; set; } + /// + /// Gets or sets the width of the primary image. + /// + /// The width of the primary image. + public int PrimaryImageWidth { get; set; } + /// + /// Gets or sets the custom prefs. + /// + /// The custom prefs. + public Dictionary CustomPrefs { get; set; } + /// + /// Gets or sets the scroll direction. + /// + /// The scroll direction. + public ScrollDirection ScrollDirection { get; set; } + /// + /// Gets or sets a value indicating whether to show backdrops on this item. + /// + /// true if showing backdrops; otherwise, false. + public bool ShowBackdrop { get; set; } + /// + /// Gets or sets a value indicating whether [remember sorting]. + /// + /// true if [remember sorting]; otherwise, false. + public bool RememberSorting { get; set; } + /// + /// Gets or sets the sort order. + /// + /// The sort order. + public SortOrder SortOrder { get; set; } + /// + /// Gets or sets a value indicating whether [show sidebar]. + /// + /// true if [show sidebar]; otherwise, false. + public bool ShowSidebar { get; set; } + /// + /// Gets or sets the client + /// + public string Client { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/EmptyRequestResult.cs b/MediaBrowser.Model/Entities/EmptyRequestResult.cs new file mode 100644 index 0000000000..5c9a725fd9 --- /dev/null +++ b/MediaBrowser.Model/Entities/EmptyRequestResult.cs @@ -0,0 +1,7 @@ + +namespace MediaBrowser.Model.Entities +{ + public class EmptyRequestResult + { + } +} diff --git a/MediaBrowser.Model/Entities/ExtraType.cs b/MediaBrowser.Model/Entities/ExtraType.cs new file mode 100644 index 0000000000..ab8da58c07 --- /dev/null +++ b/MediaBrowser.Model/Entities/ExtraType.cs @@ -0,0 +1,16 @@ + +namespace MediaBrowser.Model.Entities +{ + public enum ExtraType + { + Clip = 1, + Trailer = 2, + BehindTheScenes = 3, + DeletedScene = 4, + Interview = 5, + Scene = 6, + Sample = 7, + ThemeSong = 8, + ThemeVideo = 9 + } +} diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs new file mode 100644 index 0000000000..796850dbd4 --- /dev/null +++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods + /// + public interface IHasProviderIds + { + /// + /// Gets or sets the provider ids. + /// + /// The provider ids. + Dictionary ProviderIds { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/ImageType.cs b/MediaBrowser.Model/Entities/ImageType.cs new file mode 100644 index 0000000000..6e0ba717f0 --- /dev/null +++ b/MediaBrowser.Model/Entities/ImageType.cs @@ -0,0 +1,58 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum ImageType + /// + public enum ImageType + { + /// + /// The primary + /// + Primary = 0, + /// + /// The art + /// + Art = 1, + /// + /// The backdrop + /// + Backdrop = 2, + /// + /// The banner + /// + Banner = 3, + /// + /// The logo + /// + Logo = 4, + /// + /// The thumb + /// + Thumb = 5, + /// + /// The disc + /// + Disc = 6, + /// + /// The box + /// + Box = 7, + /// + /// The screenshot + /// + Screenshot = 8, + /// + /// The menu + /// + Menu = 9, + /// + /// The chapter image + /// + Chapter = 10, + /// + /// The box rear + /// + BoxRear = 11 + } +} diff --git a/MediaBrowser.Model/Entities/IsoType.cs b/MediaBrowser.Model/Entities/IsoType.cs new file mode 100644 index 0000000000..567b98ab9a --- /dev/null +++ b/MediaBrowser.Model/Entities/IsoType.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum IsoType + /// + public enum IsoType + { + /// + /// The DVD + /// + Dvd, + /// + /// The blu ray + /// + BluRay + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs new file mode 100644 index 0000000000..dfab9add23 --- /dev/null +++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs @@ -0,0 +1,62 @@ +using System; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class LibraryUpdateInfo + /// + public class LibraryUpdateInfo + { + /// + /// Gets or sets the folders added to. + /// + /// The folders added to. + public string[] FoldersAddedTo { get; set; } + /// + /// Gets or sets the folders removed from. + /// + /// The folders removed from. + public string[] FoldersRemovedFrom { get; set; } + + /// + /// Gets or sets the items added. + /// + /// The items added. + public string[] ItemsAdded { get; set; } + + /// + /// Gets or sets the items removed. + /// + /// The items removed. + public string[] ItemsRemoved { get; set; } + + /// + /// Gets or sets the items updated. + /// + /// The items updated. + public string[] ItemsUpdated { get; set; } + + public string[] CollectionFolders { get; set; } + + public bool IsEmpty + { + get + { + return FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0; + } + } + + /// + /// Initializes a new instance of the class. + /// + public LibraryUpdateInfo() + { + FoldersAddedTo = new string[] { }; + FoldersRemovedFrom = new string[] { }; + ItemsAdded = new string[] { }; + ItemsRemoved = new string[] { }; + ItemsUpdated = new string[] { }; + CollectionFolders = new string[] { }; + } + } +} diff --git a/MediaBrowser.Model/Entities/LocationType.cs b/MediaBrowser.Model/Entities/LocationType.cs new file mode 100644 index 0000000000..84de803aa2 --- /dev/null +++ b/MediaBrowser.Model/Entities/LocationType.cs @@ -0,0 +1,26 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum LocationType + /// + public enum LocationType + { + /// + /// The file system + /// + FileSystem = 0, + /// + /// The remote + /// + Remote = 1, + /// + /// The virtual + /// + Virtual = 2, + /// + /// The offline + /// + Offline = 3 + } +} diff --git a/MediaBrowser.Model/Entities/MBRegistrationRecord.cs b/MediaBrowser.Model/Entities/MBRegistrationRecord.cs new file mode 100644 index 0000000000..00176fb344 --- /dev/null +++ b/MediaBrowser.Model/Entities/MBRegistrationRecord.cs @@ -0,0 +1,14 @@ +using System; + +namespace MediaBrowser.Model.Entities +{ + public class MBRegistrationRecord + { + public DateTime ExpirationDate { get; set; } + public bool IsRegistered { get; set; } + public bool RegChecked { get; set; } + public bool RegError { get; set; } + public bool TrialVersion { get; set; } + public bool IsValid { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs new file mode 100644 index 0000000000..fc208459df --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -0,0 +1,475 @@ +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.MediaInfo; +using System.Globalization; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class MediaStream + /// + public class MediaStream + { + /// + /// Gets or sets the codec. + /// + /// The codec. + public string Codec { get; set; } + + /// + /// Gets or sets the codec tag. + /// + /// The codec tag. + public string CodecTag { get; set; } + + /// + /// Gets or sets the language. + /// + /// The language. + public string Language { get; set; } + + public string ColorTransfer { get; set; } + public string ColorPrimaries { get; set; } + public string ColorSpace { get; set; } + + /// + /// Gets or sets the comment. + /// + /// The comment. + public string Comment { get; set; } + + public string TimeBase { get; set; } + public string CodecTimeBase { get; set; } + + public string Title { get; set; } + + public string VideoRange + { + get + { + if (Type != MediaStreamType.Video) + { + return null; + } + + var colorTransfer = ColorTransfer; + + if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)) + { + return "HDR"; + } + + return "SDR"; + } + } + + public string DisplayTitle + { + get + { + if (Type == MediaStreamType.Audio) + { + //if (!string.IsNullOrEmpty(Title)) + //{ + // return AddLanguageIfNeeded(Title); + //} + + List attributes = new List(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(StringHelper.FirstToUpper(Language)); + } + if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca")) + { + attributes.Add(AudioCodec.GetFriendlyName(Codec)); + } + else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) + { + attributes.Add(Profile); + } + + if (!string.IsNullOrEmpty(ChannelLayout)) + { + attributes.Add(ChannelLayout); + } + else if (Channels.HasValue) + { + attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch"); + } + if (IsDefault) + { + attributes.Add("Default"); + } + + return string.Join(" ", attributes.ToArray(attributes.Count)); + } + + if (Type == MediaStreamType.Video) + { + List attributes = new List(); + + var resolutionText = GetResolutionText(); + + if (!string.IsNullOrEmpty(resolutionText)) + { + attributes.Add(resolutionText); + } + + if (!string.IsNullOrEmpty(Codec)) + { + attributes.Add(Codec.ToUpper()); + } + + return string.Join(" ", attributes.ToArray(attributes.Count)); + } + + if (Type == MediaStreamType.Subtitle) + { + //if (!string.IsNullOrEmpty(Title)) + //{ + // return AddLanguageIfNeeded(Title); + //} + + List attributes = new List(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(StringHelper.FirstToUpper(Language)); + } + else + { + attributes.Add("Und"); + } + + if (IsDefault) + { + attributes.Add("Default"); + } + + if (IsForced) + { + attributes.Add("Forced"); + } + + string name = string.Join(" ", attributes.ToArray(attributes.Count)); + + return name; + } + + if (Type == MediaStreamType.Video) + { + + } + + return null; + } + } + + private string GetResolutionText() + { + var i = this; + + if (i.Width.HasValue && i.Height.HasValue) + { + var width = i.Width.Value; + var height = i.Height.Value; + + if (width >= 3800 || height >= 2000) + { + return "4K"; + } + if (width >= 2500) + { + if (i.IsInterlaced) + { + return "1440I"; + } + return "1440P"; + } + if (width >= 1900 || height >= 1000) + { + if (i.IsInterlaced) + { + return "1080I"; + } + return "1080P"; + } + if (width >= 1260 || height >= 700) + { + if (i.IsInterlaced) + { + return "720I"; + } + return "720P"; + } + if (width >= 700 || height >= 440) + { + + if (i.IsInterlaced) + { + return "480I"; + } + return "480P"; + } + + return "SD"; + } + return null; + } + + private string AddLanguageIfNeeded(string title) + { + if (!string.IsNullOrEmpty(Language) && + !string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) && + !IsLanguageInTitle(title, Language)) + { + title = StringHelper.FirstToUpper(Language) + " " + title; + } + + return title; + } + + private bool IsLanguageInTitle(string title, string language) + { + if (title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) != -1) + { + return true; + } + + return false; + } + + public string NalLengthSize { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is interlaced. + /// + /// true if this instance is interlaced; otherwise, false. + public bool IsInterlaced { get; set; } + + public bool? IsAVC { get; set; } + + /// + /// Gets or sets the channel layout. + /// + /// The channel layout. + public string ChannelLayout { get; set; } + + /// + /// Gets or sets the bit rate. + /// + /// The bit rate. + public int? BitRate { get; set; } + + /// + /// Gets or sets the bit depth. + /// + /// The bit depth. + public int? BitDepth { get; set; } + + /// + /// Gets or sets the reference frames. + /// + /// The reference frames. + public int? RefFrames { get; set; } + + /// + /// Gets or sets the length of the packet. + /// + /// The length of the packet. + public int? PacketLength { get; set; } + + /// + /// Gets or sets the channels. + /// + /// The channels. + public int? Channels { get; set; } + + /// + /// Gets or sets the sample rate. + /// + /// The sample rate. + public int? SampleRate { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is default. + /// + /// true if this instance is default; otherwise, false. + public bool IsDefault { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is forced. + /// + /// true if this instance is forced; otherwise, false. + public bool IsForced { get; set; } + + /// + /// Gets or sets the height. + /// + /// The height. + public int? Height { get; set; } + + /// + /// Gets or sets the width. + /// + /// The width. + public int? Width { get; set; } + + /// + /// Gets or sets the average frame rate. + /// + /// The average frame rate. + public float? AverageFrameRate { get; set; } + + /// + /// Gets or sets the real frame rate. + /// + /// The real frame rate. + public float? RealFrameRate { get; set; } + + /// + /// Gets or sets the profile. + /// + /// The profile. + public string Profile { get; set; } + + /// + /// Gets or sets the type. + /// + /// The type. + public MediaStreamType Type { get; set; } + + /// + /// Gets or sets the aspect ratio. + /// + /// The aspect ratio. + public string AspectRatio { get; set; } + + /// + /// Gets or sets the index. + /// + /// The index. + public int Index { get; set; } + + /// + /// Gets or sets the score. + /// + /// The score. + public int? Score { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is external. + /// + /// true if this instance is external; otherwise, false. + public bool IsExternal { get; set; } + + /// + /// Gets or sets the method. + /// + /// The method. + public SubtitleDeliveryMethod? DeliveryMethod { get; set; } + /// + /// Gets or sets the delivery URL. + /// + /// The delivery URL. + public string DeliveryUrl { get; set; } + /// + /// Gets or sets a value indicating whether this instance is external URL. + /// + /// null if [is external URL] contains no value, true if [is external URL]; otherwise, false. + public bool? IsExternalUrl { get; set; } + + public bool IsTextSubtitleStream + { + get + { + if (Type != MediaStreamType.Subtitle) return false; + + if (string.IsNullOrEmpty(Codec) && !IsExternal) + { + return false; + } + + return IsTextFormat(Codec); + } + } + + public static bool IsTextFormat(string format) + { + string codec = format ?? string.Empty; + + // sub = external .sub file + + return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) == -1 && + codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) == -1 && + codec.IndexOf("dvbsub", StringComparison.OrdinalIgnoreCase) == -1 && + !StringHelper.EqualsIgnoreCase(codec, "sub") && + !StringHelper.EqualsIgnoreCase(codec, "dvb_subtitle"); + } + + public bool SupportsSubtitleConversionTo(string toCodec) + { + if (!IsTextSubtitleStream) + { + return false; + } + + var fromCodec = Codec; + + // Can't convert from this + if (StringHelper.EqualsIgnoreCase(fromCodec, "ass")) + { + return false; + } + if (StringHelper.EqualsIgnoreCase(fromCodec, "ssa")) + { + return false; + } + + // Can't convert to this + if (StringHelper.EqualsIgnoreCase(toCodec, "ass")) + { + return false; + } + if (StringHelper.EqualsIgnoreCase(toCodec, "ssa")) + { + return false; + } + + return true; + } + + /// + /// Gets or sets a value indicating whether [supports external stream]. + /// + /// true if [supports external stream]; otherwise, false. + public bool SupportsExternalStream { get; set; } + + /// + /// Gets or sets the filename. + /// + /// The filename. + public string Path { get; set; } + + /// + /// Gets or sets the pixel format. + /// + /// The pixel format. + public string PixelFormat { get; set; } + + /// + /// Gets or sets the level. + /// + /// The level. + public double? Level { get; set; } + + /// + /// Gets a value indicating whether this instance is anamorphic. + /// + /// true if this instance is anamorphic; otherwise, false. + public bool? IsAnamorphic { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/MediaStreamType.cs b/MediaBrowser.Model/Entities/MediaStreamType.cs new file mode 100644 index 0000000000..084a411f9c --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaStreamType.cs @@ -0,0 +1,25 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum MediaStreamType + /// + public enum MediaStreamType + { + /// + /// The audio + /// + Audio, + /// + /// The video + /// + Video, + /// + /// The subtitle + /// + Subtitle, + /// + /// The embedded image + /// + EmbeddedImage + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaType.cs b/MediaBrowser.Model/Entities/MediaType.cs new file mode 100644 index 0000000000..0c9bde6fb6 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaType.cs @@ -0,0 +1,30 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class MediaType + /// + public class MediaType + { + /// + /// The video + /// + public const string Video = "Video"; + /// + /// The audio + /// + public const string Audio = "Audio"; + /// + /// The game + /// + public const string Game = "Game"; + /// + /// The photo + /// + public const string Photo = "Photo"; + /// + /// The book + /// + public const string Book = "Book"; + } +} diff --git a/MediaBrowser.Model/Entities/MediaUrl.cs b/MediaBrowser.Model/Entities/MediaUrl.cs new file mode 100644 index 0000000000..2e17bba8a8 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaUrl.cs @@ -0,0 +1,9 @@ + +namespace MediaBrowser.Model.Entities +{ + public class MediaUrl + { + public string Url { get; set; } + public string Name { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/MetadataFields.cs b/MediaBrowser.Model/Entities/MetadataFields.cs new file mode 100644 index 0000000000..85f2da31e0 --- /dev/null +++ b/MediaBrowser.Model/Entities/MetadataFields.cs @@ -0,0 +1,46 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum MetadataFields + /// + public enum MetadataFields + { + /// + /// The cast + /// + Cast, + /// + /// The genres + /// + Genres, + /// + /// The production locations + /// + ProductionLocations, + /// + /// The studios + /// + Studios, + /// + /// The tags + /// + Tags, + /// + /// The name + /// + Name, + /// + /// The overview + /// + Overview, + /// + /// The runtime + /// + Runtime, + /// + /// The official rating + /// + OfficialRating + } +} diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.cs new file mode 100644 index 0000000000..efd4339d5c --- /dev/null +++ b/MediaBrowser.Model/Entities/MetadataProviders.cs @@ -0,0 +1,41 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum MetadataProviders + /// + public enum MetadataProviders + { + Gamesdb = 1, + /// + /// The imdb + /// + Imdb = 2, + /// + /// The TMDB + /// + Tmdb = 3, + /// + /// The TVDB + /// + Tvdb = 4, + /// + /// The tvcom + /// + Tvcom = 5, + /// + /// Tmdb Collection Id + /// + TmdbCollection = 7, + MusicBrainzAlbum = 8, + MusicBrainzAlbumArtist = 9, + MusicBrainzArtist = 10, + MusicBrainzReleaseGroup = 11, + Zap2It = 12, + TvRage = 15, + AudioDbArtist = 16, + AudioDbAlbum = 17, + MusicBrainzTrack = 18, + TvMaze = 19 + } +} diff --git a/MediaBrowser.Model/Entities/PackageReviewInfo.cs b/MediaBrowser.Model/Entities/PackageReviewInfo.cs new file mode 100644 index 0000000000..52500a41ea --- /dev/null +++ b/MediaBrowser.Model/Entities/PackageReviewInfo.cs @@ -0,0 +1,38 @@ +using System; + +namespace MediaBrowser.Model.Entities +{ + public class PackageReviewInfo + { + /// + /// The package id (database key) for this review + /// + public int id { get; set; } + + /// + /// The rating value + /// + public int rating { get; set; } + + /// + /// Whether or not this review recommends this item + /// + public bool recommend { get; set; } + + /// + /// A short description of the review + /// + public string title { get; set; } + + /// + /// A full review + /// + public string review { get; set; } + + /// + /// Time of review + /// + public DateTime timestamp { get; set; } + + } +} diff --git a/MediaBrowser.Model/Entities/ParentalRating.cs b/MediaBrowser.Model/Entities/ParentalRating.cs new file mode 100644 index 0000000000..302c1e2991 --- /dev/null +++ b/MediaBrowser.Model/Entities/ParentalRating.cs @@ -0,0 +1,32 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class ParentalRating + /// + public class ParentalRating + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the value. + /// + /// The value. + public int Value { get; set; } + + public ParentalRating() + { + + } + + public ParentalRating(string name, int value) + { + Name = name; + Value = value; + } + } +} diff --git a/MediaBrowser.Model/Entities/PersonType.cs b/MediaBrowser.Model/Entities/PersonType.cs new file mode 100644 index 0000000000..bc274972da --- /dev/null +++ b/MediaBrowser.Model/Entities/PersonType.cs @@ -0,0 +1,42 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Struct PersonType + /// + public class PersonType + { + /// + /// The actor + /// + public const string Actor = "Actor"; + /// + /// The director + /// + public const string Director = "Director"; + /// + /// The composer + /// + public const string Composer = "Composer"; + /// + /// The writer + /// + public const string Writer = "Writer"; + /// + /// The guest star + /// + public const string GuestStar = "GuestStar"; + /// + /// The producer + /// + public const string Producer = "Producer"; + /// + /// The conductor + /// + public const string Conductor = "Conductor"; + /// + /// The lyricist + /// + public const string Lyricist = "Lyricist"; + } +} diff --git a/MediaBrowser.Model/Entities/PluginSecurityInfo.cs b/MediaBrowser.Model/Entities/PluginSecurityInfo.cs new file mode 100644 index 0000000000..5cab55013e --- /dev/null +++ b/MediaBrowser.Model/Entities/PluginSecurityInfo.cs @@ -0,0 +1,21 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class PluginSecurityInfo + /// + public class PluginSecurityInfo + { + /// + /// Gets or sets the supporter key. + /// + /// The supporter key. + public string SupporterKey { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is MB supporter. + /// + /// true if this instance is MB supporter; otherwise, false. + public bool IsMBSupporter { get; set; } + } +} diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs new file mode 100644 index 0000000000..e10232baa9 --- /dev/null +++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class ProviderIdsExtensions + /// + public static class ProviderIdsExtensions + { + /// + /// Determines whether [has provider identifier] [the specified instance]. + /// + /// The instance. + /// The provider. + /// true if [has provider identifier] [the specified instance]; otherwise, false. + public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); + } + + /// + /// Gets a provider id + /// + /// The instance. + /// The provider. + /// System.String. + public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return instance.GetProviderId(provider.ToString()); + } + + /// + /// Gets a provider id + /// + /// The instance. + /// The name. + /// System.String. + public static string GetProviderId(this IHasProviderIds instance, string name) + { + if (instance == null) + { + throw new ArgumentNullException("instance"); + } + + if (instance.ProviderIds == null) + { + return null; + } + + string id; + instance.ProviderIds.TryGetValue(name, out id); + return id; + } + + /// + /// Sets a provider id + /// + /// The instance. + /// The name. + /// The value. + public static void SetProviderId(this IHasProviderIds instance, string name, string value) + { + if (instance == null) + { + throw new ArgumentNullException("instance"); + } + + // If it's null remove the key from the dictionary + if (string.IsNullOrEmpty(value)) + { + if (instance.ProviderIds != null) + { + if (instance.ProviderIds.ContainsKey(name)) + { + instance.ProviderIds.Remove(name); + } + } + } + else + { + // Ensure it exists + if (instance.ProviderIds == null) + { + instance.ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + + instance.ProviderIds[name] = value; + } + } + + /// + /// Sets a provider id + /// + /// The instance. + /// The provider. + /// The value. + public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value) + { + instance.SetProviderId(provider.ToString(), value); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/ScrollDirection.cs b/MediaBrowser.Model/Entities/ScrollDirection.cs new file mode 100644 index 0000000000..ed22103003 --- /dev/null +++ b/MediaBrowser.Model/Entities/ScrollDirection.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum ScrollDirection + /// + public enum ScrollDirection + { + /// + /// The horizontal + /// + Horizontal, + /// + /// The vertical + /// + Vertical + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/SeriesStatus.cs b/MediaBrowser.Model/Entities/SeriesStatus.cs new file mode 100644 index 0000000000..d04a2856cf --- /dev/null +++ b/MediaBrowser.Model/Entities/SeriesStatus.cs @@ -0,0 +1,18 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum SeriesStatus + /// + public enum SeriesStatus + { + /// + /// The continuing + /// + Continuing, + /// + /// The ended + /// + Ended + } +} diff --git a/MediaBrowser.Model/Entities/SortOrder.cs b/MediaBrowser.Model/Entities/SortOrder.cs new file mode 100644 index 0000000000..5130449ba8 --- /dev/null +++ b/MediaBrowser.Model/Entities/SortOrder.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum SortOrder + /// + public enum SortOrder + { + /// + /// The ascending + /// + Ascending, + /// + /// The descending + /// + Descending + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/TrailerType.cs b/MediaBrowser.Model/Entities/TrailerType.cs new file mode 100644 index 0000000000..085f461cfb --- /dev/null +++ b/MediaBrowser.Model/Entities/TrailerType.cs @@ -0,0 +1,11 @@ +namespace MediaBrowser.Model.Entities +{ + public enum TrailerType + { + ComingSoonToTheaters = 1, + ComingSoonToDvd = 2, + ComingSoonToStreaming = 3, + Archive = 4, + LocalTrailer = 5 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/UserDataSaveReason.cs b/MediaBrowser.Model/Entities/UserDataSaveReason.cs new file mode 100644 index 0000000000..d9691f3953 --- /dev/null +++ b/MediaBrowser.Model/Entities/UserDataSaveReason.cs @@ -0,0 +1,34 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum UserDataSaveReason + /// + public enum UserDataSaveReason + { + /// + /// The playback start + /// + PlaybackStart = 1, + /// + /// The playback progress + /// + PlaybackProgress = 2, + /// + /// The playback finished + /// + PlaybackFinished = 3, + /// + /// The toggle played + /// + TogglePlayed = 4, + /// + /// The update user rating + /// + UpdateUserRating = 5, + /// + /// The import + /// + Import = 6 + } +} diff --git a/MediaBrowser.Model/Entities/Video3DFormat.cs b/MediaBrowser.Model/Entities/Video3DFormat.cs new file mode 100644 index 0000000000..722df42819 --- /dev/null +++ b/MediaBrowser.Model/Entities/Video3DFormat.cs @@ -0,0 +1,12 @@ + +namespace MediaBrowser.Model.Entities +{ + public enum Video3DFormat + { + HalfSideBySide, + FullSideBySide, + FullTopAndBottom, + HalfTopAndBottom, + MVC + } +} diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs new file mode 100644 index 0000000000..05c2fa32c6 --- /dev/null +++ b/MediaBrowser.Model/Entities/VideoType.cs @@ -0,0 +1,26 @@ + +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum VideoType + /// + public enum VideoType + { + /// + /// The video file + /// + VideoFile, + /// + /// The iso + /// + Iso, + /// + /// The DVD + /// + Dvd, + /// + /// The blu ray + /// + BluRay + } +} diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs new file mode 100644 index 0000000000..68f713295d --- /dev/null +++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using MediaBrowser.Model.Configuration; +using System; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Used to hold information about a user's list of configured virtual folders + /// + public class VirtualFolderInfo + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the locations. + /// + /// The locations. + public string[] Locations { get; set; } + + /// + /// Gets or sets the type of the collection. + /// + /// The type of the collection. + public string CollectionType { get; set; } + + public LibraryOptions LibraryOptions { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public VirtualFolderInfo() + { + Locations = new string[] {}; + } + + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + + /// + /// Gets or sets the primary image item identifier. + /// + /// The primary image item identifier. + public string PrimaryImageItemId { get; set; } + + public double? RefreshProgress { get; set; } + public string RefreshStatus { get; set; } + } +} -- cgit v1.2.3