Add clickable search links and enhanced debug logging

- Made search query clickable - opens provider-specific search
- Added searchProvider() function with URLs for Deezer, Qobuz, SquidWTF
- Enhanced console logging to debug progress bar data
- Logs raw playlist data and calculated percentages
- Search link opens in new tab
This commit is contained in:
2026-02-04 16:51:46 -05:00
parent ee84770397
commit ea21d5aa77

View File

@@ -1176,6 +1176,16 @@
const externalMissing = p.externalMissing || 0;
const totalInJellyfin = p.totalInJellyfin || 0;
// Debug: Log the raw data
console.log(`Playlist ${p.name}:`, {
spotifyTotal,
localCount,
externalMatched,
externalMissing,
totalInJellyfin,
rawData: p
});
// Build detailed stats string
let statsHtml = `<span class="track-count">${spotifyTotal}</span>`;
@@ -1202,9 +1212,7 @@
const completionColor = completionPct === 100 ? 'var(--success)' : completionPct >= 80 ? 'var(--accent)' : 'var(--warning)';
// Debug logging
if (p.name && (localCount > 0 || externalMatched > 0)) {
console.log(`Playlist ${p.name}: total=${spotifyTotal}, local=${localCount} (${localPct}%), external=${externalMatched} (${externalPct}%)`);
}
console.log(`Progress bar for ${p.name}: local=${localPct}%, external=${externalPct}%, total=${completionPct}%`);
return `
<tr>
@@ -1508,6 +1516,27 @@
if (res.ok) {
showToast(`${data.message}`, 'success');
// Refresh the playlists table after a delay to show updated counts
setTimeout(fetchPlaylists, 2000);
} else {
showToast(data.error || 'Failed to match tracks', 'error');
}
} catch (error) {
showToast('Failed to match tracks', 'error');
}
}
function searchProvider(query, provider) {
// Provider-specific search URLs
const searchUrls = {
'Deezer': `https://www.deezer.com/search/${encodeURIComponent(query)}`,
'Qobuz': `https://www.qobuz.com/us-en/search?q=${encodeURIComponent(query)}`,
'SquidWTF': `https://triton.squid.wtf/search/?s=${encodeURIComponent(query)}`,
'default': `https://www.google.com/search?q=${encodeURIComponent(query + ' music')}`
};
const url = searchUrls[provider] || searchUrls['default'];
window.open(url, '_blank');
}
setTimeout(fetchPlaylists, 3000);
} else {
showToast(data.error || 'Failed to match tracks', 'error');
@@ -1748,7 +1777,7 @@
<div class="track-meta">
${t.album ? escapeHtml(t.album) : ''}
${t.isrc ? '<br><small>ISRC: ' + t.isrc + '</small>' : ''}
${t.isLocal === false && t.searchQuery ? '<br><small style="color:var(--accent)">🔍 Search: ' + escapeHtml(t.searchQuery) + '</small>' : ''}
${t.isLocal === false && t.searchQuery && t.externalProvider ? '<br><small style="color:var(--accent)"><a href="#" onclick="searchProvider(\'' + escapeJs(t.searchQuery) + '\', \'' + escapeJs(t.externalProvider) + '\'); return false;" style="color:var(--accent);text-decoration:underline;">🔍 Search: ' + escapeHtml(t.searchQuery) + '</a></small>' : ''}
</div>
</div>
`;