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:
1 parent
252d2d3071
commit
3962a90b0d
1 file changed
+6
@@ -458,6 +458,12 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
|
|||||||
ff.on('close', code => {
|
ff.on('close', code => {
|
||||||
if (code === 0 && fs.existsSync(tmpFile)) {
|
if (code === 0 && fs.existsSync(tmpFile)) {
|
||||||
fs.renameSync(tmpFile, audioFile);
|
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)' : ''}`);
|
log(jobId, `✅ Fertig${hasCover ? ' (Cover 1000x1000 eingebettet)' : ''}`);
|
||||||
} else {
|
} else {
|
||||||
try { fs.unlinkSync(tmpFile); } catch {}
|
try { fs.unlinkSync(tmpFile); } catch {}
|
||||||
|
|||||||
Reference in new issue
Block a user