Add config option to select tag extractor (taglib, ffmpeg)

This commit is contained in:
Deluan 2020-09-05 20:28:27 -04:00 committed by Deluan Quintão
parent 506899b083
commit 34eda3c8fc
2 changed files with 24 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/deluan/navidrome/conf"
"github.com/deluan/navidrome/log"
)
@ -17,7 +18,18 @@ type Extractor interface {
}
func Extract(files ...string) (map[string]Metadata, error) {
e := &taglibExtractor{}
var e Extractor
switch conf.Server.Scanner.Extractor {
case "taglib":
e = &taglibExtractor{}
case "ffmpeg":
e = &ffmpegExtractor{}
default:
log.Warn("Invalid Scanner.Extractor option. Using default ffmpeg", "requested", conf.Server.Scanner.Extractor,
"validOptions", "ffmpeg,taglib")
e = &ffmpegExtractor{}
}
return e.Extract(files...)
}