diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-05-18 17:48:47 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-05-18 17:48:47 -0400 |
| commit | 8023ae615b4f070e0fd3cc5e159c3abffaddc6bb (patch) | |
| tree | 3f691e2e02fff647c7a80f93416acf0dbb489822 /MediaBrowser.Model | |
| parent | 03981715149a4967705269c9da0c2bece9cbd30e (diff) | |
| parent | 34d4e4317aa9cd3e354ada10defb1ac1f142bf9f (diff) | |
Merge pull request #1746 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 18 | ||||
| -rw-r--r-- | MediaBrowser.Model/Extensions/StringHelper.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaInfo/AudioCodec.cs | 17 |
3 files changed, 33 insertions, 7 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 9b814c5cc..64c7d9aa6 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,8 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using System.Diagnostics; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Entities { @@ -53,18 +53,22 @@ namespace MediaBrowser.Model.Entities if (!string.IsNullOrEmpty(Language)) { - attributes.Add(Language); + attributes.Add(StringHelper.FirstToUpper(Language)); } if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca")) { - attributes.Add(Codec); - } - if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) + attributes.Add(AudioCodec.GetFriendlyName(Codec)); + } + else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) { attributes.Add(Profile); } - if (Channels.HasValue) + if (!string.IsNullOrEmpty(ChannelLayout)) + { + attributes.Add(ChannelLayout); + } + else if (Channels.HasValue) { attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch"); } diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs index 99bec68a7..9cde3bfa4 100644 --- a/MediaBrowser.Model/Extensions/StringHelper.cs +++ b/MediaBrowser.Model/Extensions/StringHelper.cs @@ -125,5 +125,10 @@ namespace MediaBrowser.Model.Extensions return sb.ToString(); } + + public static string FirstToUpper(this string str) + { + return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1); + } } } diff --git a/MediaBrowser.Model/MediaInfo/AudioCodec.cs b/MediaBrowser.Model/MediaInfo/AudioCodec.cs index 5353f2b3e..93aba2f43 100644 --- a/MediaBrowser.Model/MediaInfo/AudioCodec.cs +++ b/MediaBrowser.Model/MediaInfo/AudioCodec.cs @@ -5,5 +5,22 @@ public const string AAC = "aac"; public const string MP3 = "mp3"; public const string AC3 = "ac3"; + + public static string GetFriendlyName(string codec) + { + if (string.IsNullOrEmpty(codec)) return ""; + + switch (codec.ToLower()) + { + case "ac3": + return "Dolby Digital"; + case "eac3": + return "Dolby Digital+"; + case "dca": + return "DTS"; + default: + return codec.ToUpper(); + } + } } }
\ No newline at end of file |
