aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2020-09-05 20:49:04 +0100
committerGitHub <noreply@github.com>2020-09-05 20:49:04 +0100
commit8439860b2aa38f4f0e8fa243f8efaa9b5a0d0c0b (patch)
tree577b5eb958178ccc71e74083cf9871c889ce09fe /MediaBrowser.Model/Entities
parente33824d28667df0344420d42032fbb01e9f8f659 (diff)
parent9cffa66a015c5200e461f396cd408949591d9552 (diff)
Merge branch 'master' into Plugins
Diffstat (limited to 'MediaBrowser.Model/Entities')
-rw-r--r--MediaBrowser.Model/Entities/DisplayPreferencesDto.cs (renamed from MediaBrowser.Model/Entities/DisplayPreferences.cs)12
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs237
-rw-r--r--MediaBrowser.Model/Entities/ScrollDirection.cs18
-rw-r--r--MediaBrowser.Model/Entities/SortOrder.cs18
4 files changed, 145 insertions, 140 deletions
diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferencesDto.cs
index 7e5c5be3b..1f7fe3030 100644
--- a/MediaBrowser.Model/Entities/DisplayPreferences.cs
+++ b/MediaBrowser.Model/Entities/DisplayPreferencesDto.cs
@@ -1,22 +1,18 @@
#nullable disable
using System.Collections.Generic;
+using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Defines the display preferences for any item that supports them (usually Folders).
/// </summary>
- public class DisplayPreferences
+ public class DisplayPreferencesDto
{
/// <summary>
- /// The image scale.
+ /// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
/// </summary>
- private const double ImageScale = .9;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="DisplayPreferences" /> class.
- /// </summary>
- public DisplayPreferences()
+ public DisplayPreferencesDto()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 7a488005e..2d37618c2 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -36,6 +36,18 @@ namespace MediaBrowser.Model.Entities
public string Language { get; set; }
/// <summary>
+ /// Gets or sets the color range.
+ /// </summary>
+ /// <value>The color range.</value>
+ public string ColorRange { get; set; }
+
+ /// <summary>
+ /// Gets or sets the color space.
+ /// </summary>
+ /// <value>The color space.</value>
+ public string ColorSpace { get; set; }
+
+ /// <summary>
/// Gets or sets the color transfer.
/// </summary>
/// <value>The color transfer.</value>
@@ -48,12 +60,6 @@ namespace MediaBrowser.Model.Entities
public string ColorPrimaries { get; set; }
/// <summary>
- /// Gets or sets the color space.
- /// </summary>
- /// <value>The color space.</value>
- public string ColorSpace { get; set; }
-
- /// <summary>
/// Gets or sets the comment.
/// </summary>
/// <value>The comment.</value>
@@ -112,107 +118,146 @@ namespace MediaBrowser.Model.Entities
{
get
{
- if (Type == MediaStreamType.Audio)
- {
- // if (!string.IsNullOrEmpty(Title))
- //{
- // return AddLanguageIfNeeded(Title);
- //}
-
- var attributes = new List<string>();
-
- if (!string.IsNullOrEmpty(Language))
- {
- attributes.Add(StringHelper.FirstToUpper(Language));
- }
-
- if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
- {
- attributes.Add(AudioCodec.GetFriendlyName(Codec));
- }
- else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
- {
- 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);
- }
-
- if (Type == MediaStreamType.Video)
+ switch (Type)
{
- var attributes = new List<string>();
-
- var resolutionText = GetResolutionText();
-
- if (!string.IsNullOrEmpty(resolutionText))
+ case MediaStreamType.Audio:
{
- attributes.Add(resolutionText);
+ var attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
+ string fullLanguage = CultureInfo
+ .GetCultures(CultureTypes.NeutralCultures)
+ .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
+ ?.DisplayName;
+ attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
+ }
+
+ if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
+ {
+ attributes.Add(AudioCodec.GetFriendlyName(Codec));
+ }
+ else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
+ {
+ attributes.Add(Profile);
+ }
+
+ if (!string.IsNullOrEmpty(ChannelLayout))
+ {
+ attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
+ }
+ else if (Channels.HasValue)
+ {
+ attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
+ }
+
+ if (IsDefault)
+ {
+ attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
+ }
+
+ if (!string.IsNullOrEmpty(Title))
+ {
+ var result = new StringBuilder(Title);
+ foreach (var tag in attributes)
+ {
+ // Keep Tags that are not already in Title.
+ if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ result.Append(" - ").Append(tag);
+ }
+ }
+
+ return result.ToString();
+ }
+
+ return string.Join(" - ", attributes);
}
- if (!string.IsNullOrEmpty(Codec))
+ case MediaStreamType.Video:
{
- attributes.Add(Codec.ToUpperInvariant());
+ var attributes = new List<string>();
+
+ var resolutionText = GetResolutionText();
+
+ if (!string.IsNullOrEmpty(resolutionText))
+ {
+ attributes.Add(resolutionText);
+ }
+
+ if (!string.IsNullOrEmpty(Codec))
+ {
+ attributes.Add(Codec.ToUpperInvariant());
+ }
+
+ if (!string.IsNullOrEmpty(Title))
+ {
+ var result = new StringBuilder(Title);
+ foreach (var tag in attributes)
+ {
+ // Keep Tags that are not already in Title.
+ if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ result.Append(" - ").Append(tag);
+ }
+ }
+
+ return result.ToString();
+ }
+
+ return string.Join(" ", attributes);
}
- return string.Join(" ", attributes);
- }
-
- if (Type == MediaStreamType.Subtitle)
- {
-
- var attributes = new List<string>();
-
- if (!string.IsNullOrEmpty(Language))
+ case MediaStreamType.Subtitle:
{
- attributes.Add(StringHelper.FirstToUpper(Language));
- }
- else
- {
- attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
- }
-
- if (IsDefault)
- {
- attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
- }
-
- if (IsForced)
- {
- attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
+ var attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
+ string fullLanguage = CultureInfo
+ .GetCultures(CultureTypes.NeutralCultures)
+ .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
+ ?.DisplayName;
+ attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
+ }
+ else
+ {
+ attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
+ }
+
+ if (IsDefault)
+ {
+ attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
+ }
+
+ if (IsForced)
+ {
+ attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
+ }
+
+ if (!string.IsNullOrEmpty(Title))
+ {
+ var result = new StringBuilder(Title);
+ foreach (var tag in attributes)
+ {
+ // Keep Tags that are not already in Title.
+ if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ result.Append(" - ").Append(tag);
+ }
+ }
+
+ return result.ToString();
+ }
+
+ return string.Join(" - ", attributes);
}
- if (!string.IsNullOrEmpty(Title))
- {
- return attributes.AsEnumerable()
- // keep Tags that are not already in Title
- .Where(tag => Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
- // attributes concatenation, starting with Title
- .Aggregate(new StringBuilder(Title), (builder, attr) => builder.Append(" - ").Append(attr))
- .ToString();
- }
-
- return string.Join(" - ", attributes.ToArray());
+ default:
+ return null;
}
-
- if (Type == MediaStreamType.Video)
- {
- }
-
- return null;
}
}
diff --git a/MediaBrowser.Model/Entities/ScrollDirection.cs b/MediaBrowser.Model/Entities/ScrollDirection.cs
deleted file mode 100644
index a1de0edcb..000000000
--- a/MediaBrowser.Model/Entities/ScrollDirection.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// Enum ScrollDirection.
- /// </summary>
- public enum ScrollDirection
- {
- /// <summary>
- /// The horizontal.
- /// </summary>
- Horizontal,
-
- /// <summary>
- /// The vertical.
- /// </summary>
- Vertical
- }
-}
diff --git a/MediaBrowser.Model/Entities/SortOrder.cs b/MediaBrowser.Model/Entities/SortOrder.cs
deleted file mode 100644
index f3abc06f3..000000000
--- a/MediaBrowser.Model/Entities/SortOrder.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// Enum SortOrder.
- /// </summary>
- public enum SortOrder
- {
- /// <summary>
- /// The ascending.
- /// </summary>
- Ascending,
-
- /// <summary>
- /// The descending.
- /// </summary>
- Descending
- }
-}