Worker: also log found Blender at startup

Similar to the logging of the found FFmpeg, log the version of Blender at
Worker startup.
This commit is contained in:
Sybren A. Stüvel 2022-07-29 09:48:56 +02:00
parent 377583c9e2
commit 4947712bec
2 changed files with 23 additions and 0 deletions

View File

@ -1,11 +1,14 @@
package main package main
import ( import (
"context"
"errors" "errors"
"io/fs" "io/fs"
"time"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"git.blender.org/flamenco/internal/find_blender"
"git.blender.org/flamenco/internal/find_ffmpeg" "git.blender.org/flamenco/internal/find_ffmpeg"
) )
@ -21,3 +24,22 @@ func findFFmpeg() {
log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system") log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system")
} }
} }
// findBlender tries to find Blender, in order to show its version (if found) or a message (if not).
func findBlender() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
result, err := find_blender.Find(ctx)
switch {
case errors.Is(err, fs.ErrNotExist):
log.Warn().Msg("Blender could not be found, Flamenco Manager will have to supply a full path")
case err != nil:
log.Warn().Err(err).Msg("there was an unexpected error finding Blender on this system, Flamenco Manager will have to supply a full path")
default:
log.Info().
Str("path", result.FoundLocation).
Str("version", result.BlenderVersion).
Msg("Blender found on this system, it will be used unless Flamenco Manager specifies a path to a different Blender")
}
}

View File

@ -95,6 +95,7 @@ func main() {
configWrangler.SetManagerURL(url) configWrangler.SetManagerURL(url)
} }
findBlender()
findFFmpeg() findFFmpeg()
// Give the auto-discovery some time to find a Manager. // Give the auto-discovery some time to find a Manager.