diff options
| author | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
|---|---|---|
| committer | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
| commit | baf5cf2544fcaad2246923f60caaf3fed4a94aaf (patch) | |
| tree | a808b700095f876e437b95c432c0220e241f9fda /MediaBrowser.Model/Entities | |
| parent | 8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff) | |
| parent | b9b568de13d81f9db1a8502d50940475c1d79c72 (diff) | |
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Model/Entities')
| -rw-r--r-- | MediaBrowser.Model/Entities/BaseItemInfo.cs | 39 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/DisplayPreferences.cs | 38 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/EmptyRequestResult.cs (renamed from MediaBrowser.Model/Entities/RequestResult.cs) | 0 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/IHasProviderIds.cs | 101 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/IsoType.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/LibraryUpdateInfo.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaInfo.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 62 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStreamType.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaUrl.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/PackageReviewInfo.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/ProviderIdsExtensions.cs | 103 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/ScrollDirection.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/SortOrder.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/VideoSize.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/VideoType.cs | 15 |
16 files changed, 274 insertions, 224 deletions
diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs index a280b1f71..88af18289 100644 --- a/MediaBrowser.Model/Entities/BaseItemInfo.cs +++ b/MediaBrowser.Model/Entities/BaseItemInfo.cs @@ -1,4 +1,5 @@ -using System; +using MediaBrowser.Model.Dto; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.Serialization; @@ -34,7 +35,7 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value>The type of the media.</value> public string MediaType { get; set; } - + /// <summary> /// Gets or sets the run time ticks. /// </summary> @@ -45,7 +46,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the primary image tag. /// </summary> /// <value>The primary image tag.</value> - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// <summary> /// Gets or sets the primary image item identifier. @@ -57,19 +58,19 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the logo image tag. /// </summary> /// <value>The logo image tag.</value> - public Guid? LogoImageTag { get; set; } + public string LogoImageTag { get; set; } /// <summary> /// Gets or sets the logo item identifier. /// </summary> /// <value>The logo item identifier.</value> public string LogoItemId { get; set; } - + /// <summary> /// Gets or sets the thumb image tag. /// </summary> /// <value>The thumb image tag.</value> - public Guid? ThumbImageTag { get; set; } + public string ThumbImageTag { get; set; } /// <summary> /// Gets or sets the thumb item identifier. @@ -81,7 +82,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the thumb image tag. /// </summary> /// <value>The thumb image tag.</value> - public Guid? BackdropImageTag { get; set; } + public string BackdropImageTag { get; set; } /// <summary> /// Gets or sets the thumb item identifier. @@ -136,7 +137,25 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value>The artists.</value> public List<string> Artists { get; set; } - + + /// <summary> + /// Gets or sets the media streams. + /// </summary> + /// <value>The media streams.</value> + public List<MediaStream> MediaStreams { get; set; } + + /// <summary> + /// Gets or sets the chapter images item identifier. + /// </summary> + /// <value>The chapter images item identifier.</value> + public string ChapterImagesItemId { get; set; } + + /// <summary> + /// Gets or sets the chapters. + /// </summary> + /// <value>The chapters.</value> + public List<ChapterInfoDto> Chapters { get; set; } + /// <summary> /// Gets a value indicating whether this instance has primary image. /// </summary> @@ -144,12 +163,14 @@ namespace MediaBrowser.Model.Entities [IgnoreDataMember] public bool HasPrimaryImage { - get { return PrimaryImageTag.HasValue; } + get { return PrimaryImageTag != null; } } public BaseItemInfo() { Artists = new List<string>(); + MediaStreams = new List<MediaStream>(); + Chapters = new List<ChapterInfoDto>(); } } } diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs index 829affd01..56a2c6194 100644 --- a/MediaBrowser.Model/Entities/DisplayPreferences.cs +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the user id. /// </summary> /// <value>The user id.</value> - public Guid Id { get; set; } + public string Id { get; set; } /// <summary> /// Gets or sets the type of the view. /// </summary> @@ -103,9 +103,9 @@ namespace MediaBrowser.Model.Entities /// </summary> public void IncreaseImageSize() { - var newWidth = PrimaryImageWidth / ImageScale; + double newWidth = PrimaryImageWidth / ImageScale; - var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth); + ImageSize size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null); PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageHeight = Convert.ToInt32(size.Height); @@ -116,40 +116,10 @@ namespace MediaBrowser.Model.Entities /// </summary> public void DecreaseImageSize() { - var size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale); + ImageSize size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale); PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageHeight = Convert.ToInt32(size.Height); } } - - /// <summary> - /// Enum ScrollDirection - /// </summary> - public enum ScrollDirection - { - /// <summary> - /// The horizontal - /// </summary> - Horizontal, - /// <summary> - /// The vertical - /// </summary> - Vertical - } - - /// <summary> - /// Enum SortOrder - /// </summary> - public enum SortOrder - { - /// <summary> - /// The ascending - /// </summary> - Ascending, - /// <summary> - /// The descending - /// </summary> - Descending - } } diff --git a/MediaBrowser.Model/Entities/RequestResult.cs b/MediaBrowser.Model/Entities/EmptyRequestResult.cs index 5c9a725fd..5c9a725fd 100644 --- a/MediaBrowser.Model/Entities/RequestResult.cs +++ b/MediaBrowser.Model/Entities/EmptyRequestResult.cs diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs index efb75412f..796850dbd 100644 --- a/MediaBrowser.Model/Entities/IHasProviderIds.cs +++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Model.Entities { @@ -14,102 +13,4 @@ namespace MediaBrowser.Model.Entities /// <value>The provider ids.</value> Dictionary<string, string> ProviderIds { get; set; } } - - /// <summary> - /// Class ProviderIdsExtensions - /// </summary> - public static class ProviderIdsExtensions - { - /// <summary> - /// Determines whether [has provider identifier] [the specified instance]. - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns><c>true</c> if [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns> - public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); - } - - /// <summary> - /// Gets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns>System.String.</returns> - public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return instance.GetProviderId(provider.ToString()); - } - - /// <summary> - /// Gets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="name">The name.</param> - /// <returns>System.String.</returns> - 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; - } - - /// <summary> - /// Sets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="name">The name.</param> - /// <param name="value">The value.</param> - 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<string, string>(StringComparer.OrdinalIgnoreCase); - } - - instance.ProviderIds[name] = value; - } - } - - /// <summary> - /// Sets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <param name="value">The value.</param> - public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value) - { - instance.SetProviderId(provider.ToString(), value); - } - } } diff --git a/MediaBrowser.Model/Entities/IsoType.cs b/MediaBrowser.Model/Entities/IsoType.cs new file mode 100644 index 000000000..567b98ab9 --- /dev/null +++ b/MediaBrowser.Model/Entities/IsoType.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// <summary> + /// Enum IsoType + /// </summary> + public enum IsoType + { + /// <summary> + /// The DVD + /// </summary> + Dvd, + /// <summary> + /// The blu ray + /// </summary> + BluRay + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs index dca8cd584..4371ddae4 100644 --- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs +++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs @@ -12,41 +12,41 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the folders added to. /// </summary> /// <value>The folders added to.</value> - public List<Guid> FoldersAddedTo { get; set; } + public List<string> FoldersAddedTo { get; set; } /// <summary> /// Gets or sets the folders removed from. /// </summary> /// <value>The folders removed from.</value> - public List<Guid> FoldersRemovedFrom { get; set; } + public List<string> FoldersRemovedFrom { get; set; } /// <summary> /// Gets or sets the items added. /// </summary> /// <value>The items added.</value> - public List<Guid> ItemsAdded { get; set; } + public List<string> ItemsAdded { get; set; } /// <summary> /// Gets or sets the items removed. /// </summary> /// <value>The items removed.</value> - public List<Guid> ItemsRemoved { get; set; } + public List<string> ItemsRemoved { get; set; } /// <summary> /// Gets or sets the items updated. /// </summary> /// <value>The items updated.</value> - public List<Guid> ItemsUpdated { get; set; } + public List<string> ItemsUpdated { get; set; } /// <summary> /// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class. /// </summary> public LibraryUpdateInfo() { - FoldersAddedTo = new List<Guid>(); - FoldersRemovedFrom = new List<Guid>(); - ItemsAdded = new List<Guid>(); - ItemsRemoved = new List<Guid>(); - ItemsUpdated = new List<Guid>(); + FoldersAddedTo = new List<string>(); + FoldersRemovedFrom = new List<string>(); + ItemsAdded = new List<string>(); + ItemsRemoved = new List<string>(); + ItemsUpdated = new List<string>(); } } } diff --git a/MediaBrowser.Model/Entities/MediaInfo.cs b/MediaBrowser.Model/Entities/MediaInfo.cs new file mode 100644 index 000000000..ef26cfa14 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaInfo.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + public class MediaInfo + { + /// <summary> + /// Gets or sets the media streams. + /// </summary> + /// <value>The media streams.</value> + public List<MediaStream> MediaStreams { get; set; } + + /// <summary> + /// Gets or sets the format. + /// </summary> + /// <value>The format.</value> + public string Format { get; set; } + + public int? TotalBitrate { get; set; } + + public MediaInfo() + { + MediaStreams = new List<MediaStream>(); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index d54e3c0ef..9f64b36e4 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,5 +1,6 @@ -using System.Collections.Generic; +using System; using System.Diagnostics; +using System.Runtime.Serialization; namespace MediaBrowser.Model.Entities { @@ -129,6 +130,20 @@ namespace MediaBrowser.Model.Entities /// <value><c>true</c> if this instance is external; otherwise, <c>false</c>.</value> public bool IsExternal { get; set; } + [IgnoreDataMember] + public bool IsGraphicalSubtitleStream + { + get + { + if (IsExternal) return false; + + var codec = Codec ?? string.Empty; + + return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || + codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1; + } + } + /// <summary> /// Gets or sets the filename. /// </summary> @@ -147,49 +162,4 @@ namespace MediaBrowser.Model.Entities /// <value>The level.</value> public double? Level { get; set; } } - - /// <summary> - /// Enum MediaStreamType - /// </summary> - public enum MediaStreamType - { - /// <summary> - /// The audio - /// </summary> - Audio, - /// <summary> - /// The video - /// </summary> - Video, - /// <summary> - /// The subtitle - /// </summary> - Subtitle, - /// <summary> - /// The embedded image - /// </summary> - EmbeddedImage - } - - public class MediaInfo - { - /// <summary> - /// Gets or sets the media streams. - /// </summary> - /// <value>The media streams.</value> - public List<MediaStream> MediaStreams { get; set; } - - /// <summary> - /// Gets or sets the format. - /// </summary> - /// <value>The format.</value> - public string Format { get; set; } - - public int? TotalBitrate { get; set; } - - public MediaInfo() - { - MediaStreams = new List<MediaStream>(); - } - } } diff --git a/MediaBrowser.Model/Entities/MediaStreamType.cs b/MediaBrowser.Model/Entities/MediaStreamType.cs new file mode 100644 index 000000000..084a411f9 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaStreamType.cs @@ -0,0 +1,25 @@ +namespace MediaBrowser.Model.Entities +{ + /// <summary> + /// Enum MediaStreamType + /// </summary> + public enum MediaStreamType + { + /// <summary> + /// The audio + /// </summary> + Audio, + /// <summary> + /// The video + /// </summary> + Video, + /// <summary> + /// The subtitle + /// </summary> + Subtitle, + /// <summary> + /// The embedded image + /// </summary> + EmbeddedImage + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaUrl.cs b/MediaBrowser.Model/Entities/MediaUrl.cs index 857e91fec..9aa7207ed 100644 --- a/MediaBrowser.Model/Entities/MediaUrl.cs +++ b/MediaBrowser.Model/Entities/MediaUrl.cs @@ -8,10 +8,4 @@ namespace MediaBrowser.Model.Entities public VideoSize? VideoSize { get; set; } public bool IsDirectLink { get; set; } } - - public enum VideoSize - { - StandardDefinition, - HighDefinition - } } diff --git a/MediaBrowser.Model/Entities/PackageReviewInfo.cs b/MediaBrowser.Model/Entities/PackageReviewInfo.cs index c350935f4..52500a41e 100644 --- a/MediaBrowser.Model/Entities/PackageReviewInfo.cs +++ b/MediaBrowser.Model/Entities/PackageReviewInfo.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Model.Entities { diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs new file mode 100644 index 000000000..e10232baa --- /dev/null +++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + /// <summary> + /// Class ProviderIdsExtensions + /// </summary> + public static class ProviderIdsExtensions + { + /// <summary> + /// Determines whether [has provider identifier] [the specified instance]. + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="provider">The provider.</param> + /// <returns><c>true</c> if [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns> + public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); + } + + /// <summary> + /// Gets a provider id + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="provider">The provider.</param> + /// <returns>System.String.</returns> + public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return instance.GetProviderId(provider.ToString()); + } + + /// <summary> + /// Gets a provider id + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="name">The name.</param> + /// <returns>System.String.</returns> + 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; + } + + /// <summary> + /// Sets a provider id + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="name">The name.</param> + /// <param name="value">The value.</param> + 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<string, string>(StringComparer.OrdinalIgnoreCase); + } + + instance.ProviderIds[name] = value; + } + } + + /// <summary> + /// Sets a provider id + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="provider">The provider.</param> + /// <param name="value">The value.</param> + 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 000000000..ed2210300 --- /dev/null +++ b/MediaBrowser.Model/Entities/ScrollDirection.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// <summary> + /// Enum ScrollDirection + /// </summary> + public enum ScrollDirection + { + /// <summary> + /// The horizontal + /// </summary> + Horizontal, + /// <summary> + /// The vertical + /// </summary> + Vertical + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/SortOrder.cs b/MediaBrowser.Model/Entities/SortOrder.cs new file mode 100644 index 000000000..5130449ba --- /dev/null +++ b/MediaBrowser.Model/Entities/SortOrder.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// <summary> + /// Enum SortOrder + /// </summary> + public enum SortOrder + { + /// <summary> + /// The ascending + /// </summary> + Ascending, + /// <summary> + /// The descending + /// </summary> + Descending + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/VideoSize.cs b/MediaBrowser.Model/Entities/VideoSize.cs new file mode 100644 index 000000000..0100f3b90 --- /dev/null +++ b/MediaBrowser.Model/Entities/VideoSize.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Entities +{ + public enum VideoSize + { + StandardDefinition, + HighDefinition + } +}
\ No newline at end of file diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs index b2742add1..aa9a3c55f 100644 --- a/MediaBrowser.Model/Entities/VideoType.cs +++ b/MediaBrowser.Model/Entities/VideoType.cs @@ -27,19 +27,4 @@ namespace MediaBrowser.Model.Entities /// </summary> HdDvd } - - /// <summary> - /// Enum IsoType - /// </summary> - public enum IsoType - { - /// <summary> - /// The DVD - /// </summary> - Dvd, - /// <summary> - /// The blu ray - /// </summary> - BluRay - } } |
