harden qobuz and downloader reliability edge cases

This commit is contained in:
2026-04-21 18:54:10 +02:00
parent 0161c01a4c
commit de4e561377
8 changed files with 424 additions and 35 deletions

View File

@@ -72,6 +72,17 @@ func buildFFmpegArgs(inputPath, outputPath string, p profile, cfg config.Convers
"-c:a", p.codecLib,
}
if supportsAttachedPicture(p.ext) {
args = append(args,
"-map", "0:v:0?",
"-c:v", "mjpeg",
"-disposition:v:0", "attached_pic",
)
if p.ext == "mp3" {
args = append(args, "-id3v2_version", "3")
}
}
if p.lossless {
filter := buildLosslessFilter(cfg)
if filter != "" {
@@ -87,6 +98,15 @@ func buildFFmpegArgs(inputPath, outputPath string, p profile, cfg config.Convers
return args
}
func supportsAttachedPicture(ext string) bool {
switch strings.TrimPrefix(strings.ToLower(ext), ".") {
case "flac", "mp3", "m4a", "mp4":
return true
default:
return false
}
}
func buildLosslessFilter(cfg config.ConversionConfig) string {
parts := make([]string, 0, 2)
if cfg.SamplingRate > 0 {