Reduce verbose logging in cover migration script

This commit is contained in:
Hördle Bot
2025-11-24 09:58:49 +01:00
parent 7011a24b46
commit cd19a6c04d

View File

@@ -33,10 +33,18 @@ async function migrate() {
console.log(`Found ${songs.length} songs without cover image.`);
if (songs.length === 0) {
console.log('✅ All songs already have cover images!');
await writeFile(flagPath, new Date().toISOString());
return;
}
let processed = 0;
let successful = 0;
for (const song of songs) {
try {
const filePath = path.join(process.cwd(), 'public/uploads', song.filename);
console.log(`Processing ${song.title} (${song.filename})...`);
const buffer = await readFile(filePath);
const metadata = await parseBuffer(buffer);
@@ -57,14 +65,16 @@ async function migrate() {
data: { coverImage: coverFilename }
});
console.log(`✅ Extracted cover for ${song.title}`);
successful++;
}
processed++;
} catch (e) {
console.error(`❌ Failed to process ${song.title}:`, e.message);
processed++;
}
}
console.log('Migration completed.');
console.log(`✅ Cover migration completed: ${successful}/${processed} songs processed successfully.`);
// Create flag file to prevent re-running
await writeFile(flagPath, new Date().toISOString());