From 303feafc3cb70a11ecf26513fed9b41f1208290f Mon Sep 17 00:00:00 2001 From: CaIon Date: Wed, 29 Oct 2025 22:47:39 +0800 Subject: [PATCH] fix(audio): add support for .opus files in audio duration calculation --- common/audio.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/audio.go b/common/audio.go index e41b61653..1eb1079de 100644 --- a/common/audio.go +++ b/common/audio.go @@ -30,10 +30,11 @@ func GetAudioDuration(ctx context.Context, f io.ReadSeeker, ext string) (duratio duration, err = getFLACDuration(f) case ".m4a", ".mp4": duration, err = getM4ADuration(f) - case ".ogg", ".oga": + case ".ogg", ".oga", ".opus": duration, err = getOGGDuration(f) - case ".opus": - duration, err = getOpusDuration(f) + if err != nil { + duration, err = getOpusDuration(f) + } case ".aiff", ".aif", ".aifc": duration, err = getAIFFDuration(f) case ".webm":