From e09641b452fcdd76c08dc18abeefa089f92212f1 Mon Sep 17 00:00:00 2001 From: GermanCoding Date: Fri, 4 Mar 2022 00:55:20 +0100 Subject: [PATCH 1/2] Hide ISO 639-2 special codes in display titles They are still shown in associated metadata, just hidden from the more visible display titles. --- MediaBrowser.Model/Entities/MediaStream.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 38ac44794d..d89d629d20 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -17,6 +17,18 @@ namespace MediaBrowser.Model.Entities /// public class MediaStream { + private static readonly string[] _specialCodes = + { + // Uncoded languages. + "mis", + // Multiple languages. + "mul", + // Undetermined. + "und", + // No linguistic content; not applicable. + "zxx" + }; + /// /// Gets or sets the codec. /// @@ -137,7 +149,8 @@ namespace MediaBrowser.Model.Entities { var attributes = new List(); - if (!string.IsNullOrEmpty(Language)) + // Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded). + if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparer.OrdinalIgnoreCase)) { // 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 From 3f6a14e1fd458eb6455d2c07f516dc827fdf3239 Mon Sep 17 00:00:00 2001 From: GermanCoding Date: Fri, 4 Mar 2022 16:44:55 +0100 Subject: [PATCH 2/2] Use extension method for list search --- MediaBrowser.Model/Entities/MediaStream.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index d89d629d20..341e4846e9 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; +using Jellyfin.Extensions; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; @@ -150,7 +151,7 @@ namespace MediaBrowser.Model.Entities var attributes = new List(); // Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded). - if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparer.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase)) { // 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