feat(dl): add metadata, lyrics, and cover art tagging

Introduce metadata handling for online downloads:
- Embed cover art and lyrics (synced/unsynced) into MP3 files
- Save cover art to album folders and .lrc lyric files as sidecars
- Fetch and parse album/track metadata and lyrics from Deezer API
- Add user settings for artwork and lyrics embedding, LRC export, and cover quality
- Refactor queue manager to run continuously in background
This commit is contained in:
2025-10-02 10:57:27 -04:00
parent d1edc8b7f7
commit 36c0bc7dc7
11 changed files with 568 additions and 15 deletions

View File

@@ -19,6 +19,7 @@ import type { DeezerTrack } from '$lib/types/deezer';
export class DeezerQueueManager {
private isProcessing = false;
private abortController: AbortController | null = null;
private albumCoverCache: Map<string, Uint8Array> = new Map();
/**
* Start processing the queue
@@ -33,6 +34,9 @@ export class DeezerQueueManager {
this.abortController = new AbortController();
console.log('[DeezerQueueManager] Starting queue processor');
// Clear any stale currentJob from previous session
await setCurrentJob(null);
try {
await this.processQueue();
} catch (error) {
@@ -57,16 +61,19 @@ export class DeezerQueueManager {
/**
* Main queue processing loop
* Runs continuously while the app is open, waiting for new items
*/
private async processQueue(): Promise<void> {
console.log('[DeezerQueueManager] Queue processor started');
while (this.isProcessing) {
const queueState = get(downloadQueue);
const nextItem = getNextQueuedItem(queueState);
if (!nextItem) {
// No more items to process
console.log('[DeezerQueueManager] Queue empty, stopping');
break;
// No items to process - wait and check again
await new Promise(resolve => setTimeout(resolve, 500));
continue;
}
console.log(`[DeezerQueueManager] Processing item: ${nextItem.title}`);
@@ -99,6 +106,8 @@ export class DeezerQueueManager {
// Clear current job
await setCurrentJob(null);
}
console.log('[DeezerQueueManager] Queue processor stopped');
}
/**