fix: delete cover.jpg and leftover webm/m4a after ffmpeg embed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-02 18:09:12 +02:00
1 parent 252d2d3071
commit 3962a90b0d
1 file changed
+6
+6
View File
@@ -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 {}