fixed common track scanning bugs with custom workarounds

This commit is contained in:
2026-02-20 17:14:03 -05:00
parent 84f027aedf
commit 089af5e299
7 changed files with 817 additions and 10 deletions
+6 -3
View File
@@ -15,12 +15,15 @@ import (
func getTrackDuration(f *os.File) (int64, error) {
ext := filepath.Ext(f.Name())
if ext == ".mp3" {
switch ext {
case ".mp3":
return getMP3Duration(f)
case ".flac":
return getFlacDuration(f)
}
// FLAC, OGG, and WAV: beep's Decode() + Len() is already
// cheap (reads headers/metadata only, no full audio decode).
// OGG and WAV: beep's Decode() + Len() is already cheap
// (reads headers/metadata only, no full audio decode).
streamer, format, err := DecodeFile(f)
if err != nil {
return 0, fmt.Errorf("error decoding file: %w", err)