diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2016-05-18 14:23:46 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2016-05-18 14:23:46 -0400 |
| commit | 7841d9eb66cece2cc72307e9b9a078acd50943c7 (patch) | |
| tree | 2f93759e45ae73641e2f5af0f2bfd4041d306278 | |
| parent | d1d0487feee578822e76ca48e88dc61b94080570 (diff) | |
Friendly stream names
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 14 | ||||
| -rw-r--r-- | MediaBrowser.Model/Extensions/CodecHelper.cs | 28 | ||||
| -rw-r--r-- | MediaBrowser.Model/Extensions/StringHelper.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaBrowser.Model.csproj | 1 |
4 files changed, 43 insertions, 5 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 9b814c5cc..d0d466906 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -53,18 +53,22 @@ namespace MediaBrowser.Model.Entities if (!string.IsNullOrEmpty(Language)) { - attributes.Add(Language); + attributes.Add(Language.FirstToUpper()); } if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca")) { - attributes.Add(Codec); - } - if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) + attributes.Add(CodecHelper.FriendlyName(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/CodecHelper.cs b/MediaBrowser.Model/Extensions/CodecHelper.cs new file mode 100644 index 000000000..8d037008e --- /dev/null +++ b/MediaBrowser.Model/Extensions/CodecHelper.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Model.Extensions +{ + public static class CodecHelper + { + public static string FriendlyName(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(); + } + } + } +} 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/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 7c469b9fb..dc78bcf8e 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -137,6 +137,7 @@ <Compile Include="Dto\MetadataEditorInfo.cs" /> <Compile Include="Dto\NameIdPair.cs" /> <Compile Include="Dto\NameValuePair.cs" /> + <Compile Include="Extensions\CodecHelper.cs" /> <Compile Include="FileOrganization\SmartMatchInfo.cs" /> <Compile Include="MediaInfo\LiveStreamRequest.cs" /> <Compile Include="MediaInfo\LiveStreamResponse.cs" /> |
