mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
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:
@@ -1176,6 +1176,16 @@
|
|||||||
const externalMissing = p.externalMissing || 0;
|
const externalMissing = p.externalMissing || 0;
|
||||||
const totalInJellyfin = p.totalInJellyfin || 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
|
// Build detailed stats string
|
||||||
let statsHtml = `<span class="track-count">${spotifyTotal}</span>`;
|
let statsHtml = `<span class="track-count">${spotifyTotal}</span>`;
|
||||||
|
|
||||||
@@ -1202,9 +1212,7 @@
|
|||||||
const completionColor = completionPct === 100 ? 'var(--success)' : completionPct >= 80 ? 'var(--accent)' : 'var(--warning)';
|
const completionColor = completionPct === 100 ? 'var(--success)' : completionPct >= 80 ? 'var(--accent)' : 'var(--warning)';
|
||||||
|
|
||||||
// Debug logging
|
// Debug logging
|
||||||
if (p.name && (localCount > 0 || externalMatched > 0)) {
|
console.log(`Progress bar for ${p.name}: local=${localPct}%, external=${externalPct}%, total=${completionPct}%`);
|
||||||
console.log(`Playlist ${p.name}: total=${spotifyTotal}, local=${localCount} (${localPct}%), external=${externalMatched} (${externalPct}%)`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<tr>
|
<tr>
|
||||||
@@ -1508,6 +1516,27 @@
|
|||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
showToast(`✓ ${data.message}`, 'success');
|
showToast(`✓ ${data.message}`, 'success');
|
||||||
// Refresh the playlists table after a delay to show updated counts
|
// 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);
|
setTimeout(fetchPlaylists, 3000);
|
||||||
} else {
|
} else {
|
||||||
showToast(data.error || 'Failed to match tracks', 'error');
|
showToast(data.error || 'Failed to match tracks', 'error');
|
||||||
@@ -1748,7 +1777,7 @@
|
|||||||
<div class="track-meta">
|
<div class="track-meta">
|
||||||
${t.album ? escapeHtml(t.album) : ''}
|
${t.album ? escapeHtml(t.album) : ''}
|
||||||
${t.isrc ? '<br><small>ISRC: ' + t.isrc + '</small>' : ''}
|
${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>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user