feat(settings): add lyrics cache clear button

- Add Lyrics section to Settings with cache clear button
- Add explicit debug logging for lyrics fetch/parse
- Add track change detection logging to watcher
This commit is contained in:
vicrodh committed 2026-01-10 07:15:21 -06:00
1 parent baf8a57516
commit 182479f6c2
2 files changed
+60

No files matched your search

@@ -13,6 +13,7 @@
setDownloadCacheLimit,
type DownloadCacheStats
} from '$lib/stores/downloadState';
import { clearCache as clearLyricsCache } from '$lib/stores/lyricsStore';
interface Props {
onBack?: () => void;
@@ -45,6 +46,9 @@
let isClearingDownloads = $state(false);
let downloadCacheLimit = $state('2 GB'); // Default 2GB
// Lyrics cache state
let isClearingLyrics = $state(false);
// Audio device state
let audioDevices = $state<AudioDevice[]>([]);
let audioDeviceOptions = $derived(['System Default', ...audioDevices.map(d => d.name)]);
@@ -369,6 +373,19 @@
}
}
async function handleClearLyricsCache() {
if (isClearingLyrics) return;
isClearingLyrics = true;
try {
await clearLyricsCache();
console.log('Lyrics cache cleared');
} catch (err) {
console.error('Failed to clear lyrics cache:', err);
} finally {
isClearingLyrics = false;
}
}
function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
@@ -678,6 +695,25 @@
</button>
</div>
</section>
<!-- Lyrics Section -->
<section class="section">
<h3 class="section-title">Lyrics</h3>
<div class="setting-row">
<span class="setting-label">Provider</span>
<span class="setting-value">LRCLIB / lyrics.ovh</span>
</div>
<div class="setting-row last">
<span class="setting-label">Clear Lyrics Cache</span>
<button
class="clear-btn"
onclick={handleClearLyricsCache}
disabled={isClearingLyrics}
>
{isClearingLyrics ? 'Clearing...' : 'Clear'}
</button>
</div>
</section>
</div>
<style>