diff --git a/backend/novasonic-server.js b/backend/novasonic-server.js index e697dbf..8e340f5 100644 --- a/backend/novasonic-server.js +++ b/backend/novasonic-server.js @@ -458,6 +458,12 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t ff.on('close', code => { if (code === 0 && fs.existsSync(tmpFile)) { fs.renameSync(tmpFile, audioFile); + if (hasCover) try { fs.unlinkSync(coverPath); } catch {} + // clean up any leftover webm the yt-dlp conversion didn't remove + const base = path.basename(audioFile, path.extname(audioFile)); + for (const ext of ['webm', 'webm.part', 'm4a', 'opus']) { + try { fs.unlinkSync(path.join(dir, `${base}.${ext}`)); } catch {} + } log(jobId, `✅ Fertig${hasCover ? ' (Cover 1000x1000 eingebettet)' : ''}`); } else { try { fs.unlinkSync(tmpFile); } catch {}