harden ffmpeg pipeline failure handling and stream mapping

This commit is contained in:
2026-04-21 23:07:48 +02:00
parent beb6ce6cbb
commit d65dc182f8
6 changed files with 173 additions and 14 deletions

View File

@@ -2,7 +2,9 @@ package app
import (
"context"
"errors"
"fmt"
"os/exec"
"path/filepath"
"regexp"
"sort"
@@ -903,6 +905,10 @@ func (m *Main) ripTrack(ctx context.Context, p provider.Client, source, id, fall
}
}
if err = m.Tagger.TagFLAC(outPath, tagMeta, coverPath); err != nil {
if isFFmpegMissingError(err) {
_ = m.Store.MarkFailed(ctx, source, "track", id)
return fmt.Errorf("id=%s title=%q tag: %w", id, title, err)
}
m.logf("warning: tag failed for %s: %v\n", filepath.Base(outPath), err)
}
@@ -1342,3 +1348,13 @@ func applyPlaylistMetadataOverrides(meta map[string]any, cfg config.MetadataConf
}
artist["name"] = "Various Artists"
}
func isFFmpegMissingError(err error) bool {
if err == nil {
return false
}
if errors.Is(err, exec.ErrNotFound) {
return true
}
return strings.Contains(strings.ToLower(err.Error()), "ffmpeg not found")
}