mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
fix: progress bar external detection and download row removal
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
- Handle JsonElement when deserializing ProviderIds from cache - Check for external provider keys (SquidWTF, Deezer, Qobuz, Tidal) - Fix row removal selector to properly escape path - Progress bar now correctly shows local vs external split
This commit is contained in:
@@ -377,15 +377,35 @@ public class AdminController : ControllerBase
|
|||||||
// Check if it's external by looking for external provider in ProviderIds
|
// Check if it's external by looking for external provider in ProviderIds
|
||||||
// External providers: SquidWTF, Deezer, Qobuz, Tidal
|
// External providers: SquidWTF, Deezer, Qobuz, Tidal
|
||||||
var isExternal = false;
|
var isExternal = false;
|
||||||
if (item.TryGetValue("ProviderIds", out var providerIdsObj) && providerIdsObj is Dictionary<string, string> providerIds)
|
|
||||||
|
if (item.TryGetValue("ProviderIds", out var providerIdsObj) && providerIdsObj != null)
|
||||||
{
|
{
|
||||||
// Check for external provider keys (not MusicBrainz, ISRC, etc)
|
// Handle both Dictionary<string, string> and JsonElement
|
||||||
|
Dictionary<string, string>? providerIds = null;
|
||||||
|
|
||||||
|
if (providerIdsObj is Dictionary<string, string> dict)
|
||||||
|
{
|
||||||
|
providerIds = dict;
|
||||||
|
}
|
||||||
|
else if (providerIdsObj is JsonElement jsonEl && jsonEl.ValueKind == JsonValueKind.Object)
|
||||||
|
{
|
||||||
|
providerIds = new Dictionary<string, string>();
|
||||||
|
foreach (var prop in jsonEl.EnumerateObject())
|
||||||
|
{
|
||||||
|
providerIds[prop.Name] = prop.Value.GetString() ?? "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (providerIds != null)
|
||||||
|
{
|
||||||
|
// Check for external provider keys (not MusicBrainz, ISRC, Spotify, etc)
|
||||||
isExternal = providerIds.Keys.Any(k =>
|
isExternal = providerIds.Keys.Any(k =>
|
||||||
k.Equals("SquidWTF", StringComparison.OrdinalIgnoreCase) ||
|
k.Equals("SquidWTF", StringComparison.OrdinalIgnoreCase) ||
|
||||||
k.Equals("Deezer", StringComparison.OrdinalIgnoreCase) ||
|
k.Equals("Deezer", StringComparison.OrdinalIgnoreCase) ||
|
||||||
k.Equals("Qobuz", StringComparison.OrdinalIgnoreCase) ||
|
k.Equals("Qobuz", StringComparison.OrdinalIgnoreCase) ||
|
||||||
k.Equals("Tidal", StringComparison.OrdinalIgnoreCase));
|
k.Equals("Tidal", StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isExternal)
|
if (isExternal)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1628,7 +1628,8 @@
|
|||||||
showToast('File deleted successfully', 'success');
|
showToast('File deleted successfully', 'success');
|
||||||
|
|
||||||
// Remove the row immediately for live update
|
// Remove the row immediately for live update
|
||||||
const row = document.querySelector(`tr[data-path="${CSS.escape(path)}"]`);
|
const escapedPath = path.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
||||||
|
const row = document.querySelector(`tr[data-path="${escapedPath}"]`);
|
||||||
if (row) {
|
if (row) {
|
||||||
row.remove();
|
row.remove();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user