From bb6322e1871304f4eacd74b3f08ee4508c305fd3 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Mon, 1 Jun 2026 08:30:50 +0200 Subject: [PATCH] hgfd --- src/inc/queue.mjs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/inc/queue.mjs b/src/inc/queue.mjs index 305744f..384c219 100644 --- a/src/inc/queue.mjs +++ b/src/inc/queue.mjs @@ -380,8 +380,18 @@ export default new class queue { } catch (e) { break; } } } - else if (mime.startsWith('image/') && mime != 'image/gif') - await this.spawn('magick', [sourcePath + '[0]', '-auto-orient', tmpFile]); + else if (mime.startsWith('image/') && mime != 'image/gif') { + if (mime === 'image/avif') { + try { + await this.spawn('ffmpeg', ['-i', sourcePath, '-frames:v', '1', '-update', '1', tmpFile]); + } catch (err) { + // If ffmpeg fails, fallback to magick + await this.spawn('magick', [sourcePath + '[0]', '-auto-orient', tmpFile]); + } + } else { + await this.spawn('magick', [sourcePath + '[0]', '-auto-orient', tmpFile]); + } + } else if (mime.startsWith('audio/')) { let coverExtracted = false; this._lastCoverExtracted = false; // Reset state for this call