Mirrors the existing videoExtensions/SupportsVideoFile pair. Used by upcoming audiobook and podcast scanner branches to filter directory walks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
594 B
Go
27 lines
594 B
Go
package scanner
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// audioExtensions is the set of file extensions the audiobook and podcast
|
|
// scanner branches recognize. Mirrors videoExtensions for video libraries.
|
|
var audioExtensions = map[string]bool{
|
|
".m4b": true,
|
|
".m4a": true,
|
|
".mp3": true,
|
|
".flac": true,
|
|
".opus": true,
|
|
".ogg": true,
|
|
}
|
|
|
|
// SupportsAudioFile reports whether the given path uses a recognized audio
|
|
// file extension.
|
|
func SupportsAudioFile(filePath string) bool {
|
|
if filePath == "" {
|
|
return false
|
|
}
|
|
return audioExtensions[strings.ToLower(filepath.Ext(filePath))]
|
|
}
|