flamenco/cmd/flamenco-worker/find_exes.go
Sybren A. Stüvel 02fac6a4df Change Go package name from git.blender.org to projects.blender.org
Change the package base name of the Go code, from
`git.blender.org/flamenco` to `projects.blender.org/studio/flamenco`.

The old location, `git.blender.org`, has no longer been use since the
[migration to Gitea][1]. The new package names now reflect the actual
location where Flamenco is hosted.

[1]: https://code.blender.org/2023/02/new-blender-development-infrastructure/
2023-08-01 12:42:31 +02:00

50 lines
1.7 KiB
Go

package main
import (
"context"
"errors"
"io/fs"
"os/exec"
"time"
"github.com/rs/zerolog/log"
"projects.blender.org/studio/flamenco/internal/find_blender"
"projects.blender.org/studio/flamenco/internal/find_ffmpeg"
)
// findFFmpeg tries to find FFmpeg, in order to show its version (if found) or a warning (if not).
func findFFmpeg() {
result, err := find_ffmpeg.Find()
switch {
case errors.Is(err, fs.ErrNotExist):
log.Warn().Msg("FFmpeg could not be found on this system, render jobs may not run correctly")
case err != nil:
log.Warn().Err(err).Msg("there was an unexpected error finding FFmpeg on this system, render jobs may not run correctly")
default:
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()
helpMsg := "Flamenco Manager will have to supply the full path to Blender when tasks are sent " +
"to this Worker. For more info see https://flamenco.blender.org/usage/variables/blender/"
result, err := find_blender.Find(ctx)
switch {
case errors.Is(err, fs.ErrNotExist), errors.Is(err, exec.ErrNotFound):
log.Warn().Msg("Blender could not be found. " + helpMsg)
case err != nil:
log.Warn().AnErr("cause", err).Msg("There was an error finding Blender on this system. " + helpMsg)
default:
log.Info().
Str("path", result.FoundLocation).
Str("version", result.BlenderVersion).
Msg("Blender found on this system, it will be used unless the Flamenco Manager configuration specifies a different path.")
}
}