diff options
| author | redSpoutnik <15638041+redSpoutnik@users.noreply.github.com> | 2019-03-14 22:31:51 +0100 |
|---|---|---|
| committer | redSpoutnik <15638041+redSpoutnik@users.noreply.github.com> | 2019-03-14 22:31:51 +0100 |
| commit | 427688a0a08e04e87774d01e7bfec22eecc71e7d (patch) | |
| tree | 1d9f08603d4f7a54d701b4c7c1b10e92de81b916 /MediaBrowser.Model | |
| parent | 276428878e2f61c59177d5ab23265a637a3eb7e5 (diff) | |
Change subtitles DisplayTitle behavior
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index fc346df37..8dcf679a3 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; +using System.Text; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; @@ -65,6 +67,10 @@ namespace MediaBrowser.Model.Entities } } + public string localizedUndefined { get; set; } + public string localizedDefault { get; set; } + public string localizedForced { get; set; } + public string DisplayTitle { get @@ -141,22 +147,30 @@ namespace MediaBrowser.Model.Entities } else { - attributes.Add("Und"); + attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined); } if (IsDefault) { - attributes.Add("Default"); + attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault); } if (IsForced) { - attributes.Add("Forced"); + attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced); } - string name = string.Join(" ", attributes.ToArray()); + 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 name; + return string.Join(" - ", attributes.ToArray()); } if (Type == MediaStreamType.Video) @@ -220,6 +234,7 @@ namespace MediaBrowser.Model.Entities return null; } + /* private string AddLanguageIfNeeded(string title) { if (!string.IsNullOrEmpty(Language) && @@ -241,6 +256,7 @@ namespace MediaBrowser.Model.Entities return false; } + */ public string NalLengthSize { get; set; } |
