From ff980dc42c4ebc31151a3dd4bc4d8dac738fd801 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 14 May 2016 14:02:06 -0400 Subject: add DisplayTitle to media streams --- MediaBrowser.Model/Entities/MediaStream.cs | 89 +++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Model') diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 25252956b2..9b814c5ccc 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Model.Dlna; +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using System.Diagnostics; @@ -34,6 +36,91 @@ namespace MediaBrowser.Model.Entities /// The comment. public string Comment { get; set; } + public string Title { get; set; } + + public string DisplayTitle + { + get + { + if (!string.IsNullOrEmpty(Title)) + { + return Title; + } + + if (Type == MediaStreamType.Audio) + { + List attributes = new List(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(Language); + } + if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca")) + { + attributes.Add(Codec); + } + if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) + { + attributes.Add(Profile); + } + + if (Channels.HasValue) + { + attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch"); + } + + string name = string.Join(" ", attributes.ToArray()); + + if (IsDefault) + { + name += " (D)"; + } + + return name; + } + + if (Type == MediaStreamType.Subtitle) + { + List attributes = new List(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(Language); + } + if (!string.IsNullOrEmpty(Codec)) + { + attributes.Add(Codec); + } + + string name = string.Join(" ", attributes.ToArray()); + + if (IsDefault) + { + name += " (D)"; + } + + if (IsForced) + { + name += " (F)"; + } + + if (IsExternal) + { + name += " (EXT)"; + } + + return name; + } + + if (Type == MediaStreamType.Video) + { + + } + + return null; + } + } + public string NalLengthSize { get; set; } /// -- cgit v1.2.3