diff options
| author | Joe Rogers <1337joe@users.noreply.github.com> | 2022-10-07 06:38:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-07 12:38:05 +0200 |
| commit | 2e4db18ebea51a3e0b2d9b822ccee3bad918173f (patch) | |
| tree | b29c5e4a48473f85f7ceb2ee3fa8e0dba5f3812f /Emby.Naming | |
| parent | 3612b427c455d576da7defca8d544ac0cb83d7b3 (diff) | |
Add hearing impaired subtitle stream indicator (#7379)
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
Diffstat (limited to 'Emby.Naming')
| -rw-r--r-- | Emby.Naming/Common/NamingOptions.cs | 12 | ||||
| -rw-r--r-- | Emby.Naming/ExternalFiles/ExternalPathParser.cs | 12 | ||||
| -rw-r--r-- | Emby.Naming/ExternalFiles/ExternalPathParserResult.cs | 10 |
3 files changed, 33 insertions, 1 deletions
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index e016d7e51..29cc6558c 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -280,6 +280,13 @@ namespace Emby.Naming.Common "default" }; + MediaHearingImpairedFlags = new[] + { + "cc", + "hi", + "sdh" + }; + EpisodeExpressions = new[] { // *** Begin Kodi Standard Naming @@ -728,6 +735,11 @@ namespace Emby.Naming.Common public string[] MediaDefaultFlags { get; set; } /// <summary> + /// Gets or sets list of external media hearing impaired flags. + /// </summary> + public string[] MediaHearingImpairedFlags { get; set; } + + /// <summary> /// Gets or sets list of album stacking prefixes. /// </summary> public string[] AlbumStackingPrefixes { get; set; } diff --git a/Emby.Naming/ExternalFiles/ExternalPathParser.cs b/Emby.Naming/ExternalFiles/ExternalPathParser.cs index 3bde3a1cf..1fa4fa537 100644 --- a/Emby.Naming/ExternalFiles/ExternalPathParser.cs +++ b/Emby.Naming/ExternalFiles/ExternalPathParser.cs @@ -99,6 +99,18 @@ namespace Emby.Naming.ExternalFiles pathInfo.Language = culture.ThreeLetterISOLanguageName; extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase); } + else if (culture != null && pathInfo.Language == "hin") + { + // Hindi language code "hi" collides with a hearing impaired flag - use as Hindi only if no other language is set + pathInfo.IsHearingImpaired = true; + pathInfo.Language = culture.ThreeLetterISOLanguageName; + extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase); + } + else if (_namingOptions.MediaHearingImpairedFlags.Any(s => currentSliceWithoutSeparator.Contains(s, StringComparison.OrdinalIgnoreCase))) + { + pathInfo.IsHearingImpaired = true; + extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase); + } else { titleString = currentSlice + titleString; diff --git a/Emby.Naming/ExternalFiles/ExternalPathParserResult.cs b/Emby.Naming/ExternalFiles/ExternalPathParserResult.cs index 1cc773a2e..b0d9e7a9f 100644 --- a/Emby.Naming/ExternalFiles/ExternalPathParserResult.cs +++ b/Emby.Naming/ExternalFiles/ExternalPathParserResult.cs @@ -11,11 +11,13 @@ namespace Emby.Naming.ExternalFiles /// <param name="path">Path to file.</param> /// <param name="isDefault">Is default.</param> /// <param name="isForced">Is forced.</param> - public ExternalPathParserResult(string path, bool isDefault = false, bool isForced = false) + /// <param name="isHearingImpaired">For the hearing impaired.</param> + public ExternalPathParserResult(string path, bool isDefault = false, bool isForced = false, bool isHearingImpaired = false) { Path = path; IsDefault = isDefault; IsForced = isForced; + IsHearingImpaired = isHearingImpaired; } /// <summary> @@ -47,5 +49,11 @@ namespace Emby.Naming.ExternalFiles /// </summary> /// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value> public bool IsForced { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance is for the hearing impaired. + /// </summary> + /// <value><c>true</c> if this instance is for the hearing impaired; otherwise, <c>false</c>.</value> + public bool IsHearingImpaired { get; set; } } } |
