Release 1.0.0.10: tag-based matching and metadata normalization
This commit is contained in:
1 parent
106e8f09e0
commit
0dbf00a055
17 files changed
+513
-53
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Jellyfin.Plugin.YandexMusic.Providers;
|
||||
|
||||
/// <summary>
|
||||
/// Provider ids resolved by the song provider. Jellyfin keeps existing ids during a normal
|
||||
/// refresh, so a previously wrong match can stick; the custom provider applies the resolved ids.
|
||||
/// </summary>
|
||||
public static class ProviderIdCache
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, (string Track, string? Album, string? Artist)> Cache =
|
||||
new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>Stores ids for an audio file path.</summary>
|
||||
public static void Set(string? path, string track, string? album, string? artist)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || string.IsNullOrWhiteSpace(track))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Cache[path] = (track, album, artist);
|
||||
}
|
||||
|
||||
/// <summary>Gets ids for an audio file path.</summary>
|
||||
public static bool TryGet(string? path, out (string Track, string? Album, string? Artist) ids)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(path) && Cache.TryGetValue(path, out var value))
|
||||
{
|
||||
ids = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
ids = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user