From ac81ddd39ade7e9943a3dd25abced88070382d5b Mon Sep 17 00:00:00 2001 From: Kirill Nikiforov Date: Sat, 8 Nov 2025 02:54:53 +0400 Subject: add support for more embedded metadata tags --- src/Jellyfin.Extensions/DictionaryExtensions.cs | 33 ++++++------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/Jellyfin.Extensions/DictionaryExtensions.cs b/src/Jellyfin.Extensions/DictionaryExtensions.cs index 5bb828d01..814297093 100644 --- a/src/Jellyfin.Extensions/DictionaryExtensions.cs +++ b/src/Jellyfin.Extensions/DictionaryExtensions.cs @@ -7,31 +7,6 @@ namespace Jellyfin.Extensions /// public static class DictionaryExtensions { - /// - /// Gets a string from a string dictionary, checking all keys sequentially, - /// stopping at the first key that returns a result that's neither null nor blank. - /// - /// The dictionary. - /// The first checked key. - /// System.String. - public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary dictionary, string key1) - { - return dictionary.GetFirstNotNullNorWhiteSpaceValue(key1, string.Empty, string.Empty); - } - - /// - /// Gets a string from a string dictionary, checking all keys sequentially, - /// stopping at the first key that returns a result that's neither null nor blank. - /// - /// The dictionary. - /// The first checked key. - /// The second checked key. - /// System.String. - public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary dictionary, string key1, string key2) - { - return dictionary.GetFirstNotNullNorWhiteSpaceValue(key1, key2, string.Empty); - } - /// /// Gets a string from a string dictionary, checking all keys sequentially, /// stopping at the first key that returns a result that's neither null nor blank. @@ -40,8 +15,9 @@ namespace Jellyfin.Extensions /// The first checked key. /// The second checked key. /// The third checked key. + /// The fourth checked key. /// System.String. - public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary dictionary, string key1, string key2, string key3) + public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary dictionary, string key1, string? key2 = null, string? key3 = null, string? key4 = null) { if (dictionary.TryGetValue(key1, out var val) && !string.IsNullOrWhiteSpace(val)) { @@ -58,6 +34,11 @@ namespace Jellyfin.Extensions return val; } + if (!string.IsNullOrEmpty(key4) && dictionary.TryGetValue(key4, out val) && !string.IsNullOrWhiteSpace(val)) + { + return val; + } + return null; } } -- cgit v1.2.3