mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
harden ffmpeg pipeline failure handling and stream mapping
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user