Add `ffmpeg` detection at start-up

This commit is contained in:
Deluan 2020-10-06 17:24:16 -04:00
parent 26d2af17a3
commit fea5d23fc7
3 changed files with 15 additions and 2 deletions

View File

@ -16,11 +16,10 @@ type Transcoder interface {
}
func New() Transcoder {
path, err := exec.LookPath("ffmpeg")
_, err := exec.LookPath("ffmpeg")
if err != nil {
log.Error("Unable to find ffmpeg", err)
}
log.Debug("Found ffmpeg", "path", path)
return &ffmpeg{}
}

View File

@ -3,6 +3,7 @@ package server
import (
"context"
"fmt"
"os/exec"
"time"
"github.com/deluan/navidrome/conf"
@ -79,3 +80,15 @@ func createJWTSecret(ds model.DataStore) error {
}
return err
}
func checkFfmpegInstallation() {
path, err := exec.LookPath("ffmpeg")
if err == nil {
log.Debug("Found ffmpeg", "path", path)
}
log.Warn("Unable to find ffmpeg. Transcoding will fail if used", err)
if conf.Server.Scanner.Extractor == "ffmpeg" {
log.Warn("ffmpeg cannot be used for metadata extraction. Falling back to taglib")
conf.Server.Scanner.Extractor = "taglib"
}
}

View File

@ -32,6 +32,7 @@ func New(scanner *scanner.Scanner, ds model.DataStore) *Server {
initialSetup(ds)
a.initRoutes()
a.initScanner()
checkFfmpegInstallation()
return a
}