aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.Extensions/DictionaryExtensions.cs
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2025-11-27 16:31:42 +0100
committerGitHub <noreply@github.com>2025-11-27 16:31:42 +0100
commit45669c9b30b6f24410ddb7b577bed7ca298d41a9 (patch)
tree66b4647db38046f8de3f4393ea002077fb9f0bb6 /src/Jellyfin.Extensions/DictionaryExtensions.cs
parent19c232809ed3b2f0a740239a863b66bebe41e32f (diff)
parentac81ddd39ade7e9943a3dd25abced88070382d5b (diff)
Merge pull request #15437 from allmazz/feat/more_file_metadata_tags
Add support for more embedded metadata tags
Diffstat (limited to 'src/Jellyfin.Extensions/DictionaryExtensions.cs')
-rw-r--r--src/Jellyfin.Extensions/DictionaryExtensions.cs33
1 files changed, 7 insertions, 26 deletions
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
@@ -13,35 +13,11 @@ namespace Jellyfin.Extensions
/// </summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key1">The first checked key.</param>
- /// <returns>System.String.</returns>
- public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary<string, string> dictionary, string key1)
- {
- return dictionary.GetFirstNotNullNorWhiteSpaceValue(key1, string.Empty, string.Empty);
- }
-
- /// <summary>
- /// 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.
- /// </summary>
- /// <param name="dictionary">The dictionary.</param>
- /// <param name="key1">The first checked key.</param>
- /// <param name="key2">The second checked key.</param>
- /// <returns>System.String.</returns>
- public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary<string, string> dictionary, string key1, string key2)
- {
- return dictionary.GetFirstNotNullNorWhiteSpaceValue(key1, key2, string.Empty);
- }
-
- /// <summary>
- /// 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.
- /// </summary>
- /// <param name="dictionary">The dictionary.</param>
- /// <param name="key1">The first checked key.</param>
/// <param name="key2">The second checked key.</param>
/// <param name="key3">The third checked key.</param>
+ /// <param name="key4">The fourth checked key.</param>
/// <returns>System.String.</returns>
- public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary<string, string> dictionary, string key1, string key2, string key3)
+ public static string? GetFirstNotNullNorWhiteSpaceValue(this IReadOnlyDictionary<string, string> 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;
}
}