🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Refactor a bit how ffmpeg is used to get metadata
jvoisin04eb4211869c
diff --git a/conf/configuration.go b/conf/configuration.goindex 635faf121..9913b66dc 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -29,7 +29,7 @@ type nd struct {TranscodingCacheSize string `default:"100MB"` // in MBImageCacheSize string `default:"100MB"` // in MB- ProbeCommand string `default:"ffmpeg -i %s -f ffmetadata"`+ ProbeCommand string `default:"ffmpeg %s -f ffmetadata"`// DevFlags. These are used to enable/disable debugging and incomplete featuresDevLogSourceLine bool `default:"false"`diff --git a/scanner/metadata_ffmpeg.go b/scanner/metadata_ffmpeg.goindex 4f2474149..9ca90a6d4 100644--- a/scanner/metadata_ffmpeg.go+++ b/scanner/metadata_ffmpeg.go@@ -74,10 +74,10 @@ func LoadAllAudioFiles(dirPath string) (map[string]os.FileInfo, error) {}func ExtractAllMetadata(inputs []string) (map[string]*Metadata, error) {- cmdLine, args := createProbeCommand(inputs)+ args := createProbeCommand(inputs)- log.Trace("Executing command", "arg0", cmdLine, "args", args)- cmd := exec.Command(cmdLine, args...)+ log.Trace("Executing command", "args", args)+ cmd := exec.Command(args[0], args[1:]...)output, _ := cmd.CombinedOutput()mds := map[string]*Metadata{}if len(output) == 0 {@@ -269,25 +269,18 @@ func (m *Metadata) parseDuration(tagName string) float32 {}// Inputs will always be absolute paths-func createProbeCommand(inputs []string) (string, []string) {- cmd := conf.Server.ProbeCommand-- split := strings.Split(cmd, " ")+func createProbeCommand(inputs []string) []string {+ split := strings.Split(conf.Server.ProbeCommand, " ")args := make([]string, 0)- first := true+for _, s := range split {if s == "%s" {for _, inp := range inputs {- if !first {- args = append(args, "-i")- }- args = append(args, inp)- first = false+ args = append(args, "-i", inp)}- continue+ } else {+ args = append(args, s)}- args = append(args, s)}-- return args[0], args[1:]+ return args}