Revert "Do we still need ffmpeg in the pipeline?"

Yes we do.

This reverts commit 87df7f6df7.
This commit is contained in:
Deluan 2023-12-27 19:37:11 -05:00
parent 87df7f6df7
commit 8617d66745
4 changed files with 26 additions and 2 deletions

View file

@ -13,6 +13,9 @@ jobs:
name: Lint Go code
runs-on: ubuntu-latest
steps:
- name: Update ubuntu repo
run: sudo apt-get update
- name: Install taglib
run: sudo apt-get install libtag1-dev
@ -50,8 +53,11 @@ jobs:
matrix:
go_version: [1.21.x, 1.20.x]
steps:
- name: Update ubuntu repo
run: sudo apt-get update
- name: Install taglib
run: sudo apt-get install libtag1-dev
run: sudo apt-get install libtag1-dev ffmpeg
- name: Check out code into the Go module directory
uses: actions/checkout@v3

View file

@ -22,6 +22,7 @@ type FFmpeg interface {
ConvertToFLAC(ctx context.Context, path string) (io.ReadCloser, error)
Probe(ctx context.Context, files []string) (string, error)
CmdPath() (string, error)
IsAvailable() bool
}
func New() FFmpeg {
@ -78,6 +79,11 @@ func (e *ffmpeg) CmdPath() (string, error) {
return ffmpegCmd()
}
func (e *ffmpeg) IsAvailable() bool {
_, err := ffmpegCmd()
return err == nil
}
func (e *ffmpeg) start(ctx context.Context, args []string) (io.ReadCloser, error) {
log.Trace(ctx, "Executing ffmpeg command", "cmd", args)
j := &ffCmd{args: args}

View file

@ -5,6 +5,8 @@ import (
"strings"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/conf/configtest"
"github.com/navidrome/navidrome/core/ffmpeg"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/scanner/metadata"
_ "github.com/navidrome/navidrome/scanner/metadata/ffmpeg"
@ -168,8 +170,14 @@ var _ = Describe("Tags", func() {
})
})
Context("Extract", func() {
// Only run these tests if FFmpeg is available
FFmpegContext := XContext
if ffmpeg.New().IsAvailable() {
FFmpegContext = Context
}
FFmpegContext("Extract with FFmpeg", func() {
BeforeEach(func() {
DeferCleanup(configtest.SetupConfig())
conf.Server.Scanner.Extractor = "ffmpeg"
})

View file

@ -19,6 +19,10 @@ type MockFFmpeg struct {
Error error
}
func (ff *MockFFmpeg) IsAvailable() bool {
return true
}
func (ff *MockFFmpeg) Transcode(context.Context, string, string, int, int) (io.ReadCloser, error) {
if ff.Error != nil {
return nil, ff.Error