mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Add lyrics prefetch endpoint and UI button: prefetch lyrics for individual playlists with progress feedback
This commit is contained in:
@@ -1274,6 +1274,7 @@
|
||||
<td class="cache-age">${p.cacheAge || '-'}</td>
|
||||
<td>
|
||||
<button onclick="matchPlaylistTracks('${escapeJs(p.name)}')">Match Tracks</button>
|
||||
<button onclick="prefetchLyrics('${escapeJs(p.name)}')">Prefetch Lyrics</button>
|
||||
<button onclick="viewTracks('${escapeJs(p.name)}')">View</button>
|
||||
<button class="danger" onclick="removePlaylist('${escapeJs(p.name)}')">Remove</button>
|
||||
</td>
|
||||
@@ -1568,6 +1569,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function prefetchLyrics(name) {
|
||||
try {
|
||||
showToast(`Prefetching lyrics for ${name}...`, 'info', 5000);
|
||||
const res = await fetch(`/api/admin/playlists/${encodeURIComponent(name)}/prefetch-lyrics`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
|
||||
if (res.ok) {
|
||||
const summary = `Fetched: ${data.fetched}, Cached: ${data.cached}, Missing: ${data.missing}`;
|
||||
showToast(`✓ Lyrics prefetch complete for ${name}. ${summary}`, 'success', 8000);
|
||||
} else {
|
||||
showToast(data.error || 'Failed to prefetch lyrics', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('Failed to prefetch lyrics', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
function searchProvider(query, provider) {
|
||||
// Provider-specific search URLs
|
||||
const searchUrls = {
|
||||
|
||||
Reference in New Issue
Block a user