Release 1.0.0.10: tag-based matching and metadata normalization

This commit is contained in:
1xDed committed 2026-12-01 02:28:18 +03:00
1 parent 106e8f09e0
commit 0dbf00a055
17 files changed
+513 -53

No files matched your search

@@ -0,0 +1,36 @@
using System.Collections.Concurrent;
namespace Jellyfin.Plugin.YandexMusic.Providers;
/// <summary>
/// Normalized genres resolved by the song provider, applied after Jellyfin's metadata merge
/// so raw tag ids (rusrap, pop, ...) do not stick to the item.
/// </summary>
public static class GenreCache
{
private static readonly ConcurrentDictionary<string, string[]> Cache = new(StringComparer.Ordinal);
/// <summary>Stores genres for an audio file path.</summary>
public static void Set(string? path, string[] genres)
{
if (string.IsNullOrWhiteSpace(path) || genres.Length == 0)
{
return;
}
Cache[path] = genres;
}
/// <summary>Gets genres for an audio file path.</summary>
public static bool TryGet(string? path, out string[] genres)
{
if (!string.IsNullOrWhiteSpace(path) && Cache.TryGetValue(path, out var value))
{
genres = value;
return true;
}
genres = [];
return false;
}
}