mirror of
https://github.com/zhaarey/apple-music-alac-atmos-downloader.git
synced 2026-01-15 14:22:53 -03:00
add option to skip converting lossy sources to lossless
This commit is contained in:
@@ -57,3 +57,6 @@ convert-keep-original: false # Keep original file after successful convers
|
||||
convert-skip-if-source-matches: true # If already in target format, skip
|
||||
ffmpeg-path: "ffmpeg" # Override if ffmpeg is not in PATH
|
||||
convert-extra-args: "" # Additional raw args appended (advanced)
|
||||
# Conversion warnings and behavior
|
||||
convert-warn-lossy-to-lossless: true # If true, print a warning when converting a detected lossy source to a lossless container
|
||||
convert-skip-lossy-to-lossless: true # If true, skip converting detected lossy sources to lossless target formats (flac/wav)
|
||||
|
||||
13
main.go
13
main.go
@@ -707,10 +707,15 @@ func convertIfNeeded(track *task.Track) {
|
||||
outBase := strings.TrimSuffix(srcPath, ext)
|
||||
outPath := outBase + "." + targetFmt
|
||||
|
||||
// Warn about lossy -> lossless
|
||||
if Config.ConvertWarnLossyToLossless && (targetFmt == "flac" || targetFmt == "wav") &&
|
||||
isLossySource(ext, track.Codec) {
|
||||
fmt.Println("Warning: Converting lossy source to lossless container will not improve quality.")
|
||||
// Handle lossy -> lossless cases: optionally skip or warn
|
||||
if (targetFmt == "flac" || targetFmt == "wav") && isLossySource(ext, track.Codec) {
|
||||
if Config.ConvertSkipLossyToLossless {
|
||||
fmt.Println("Skipping conversion: source appears lossy and target is lossless; configured to skip.")
|
||||
return
|
||||
}
|
||||
if Config.ConvertWarnLossyToLossless {
|
||||
fmt.Println("Warning: Converting lossy source to lossless container will not improve quality.")
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := exec.LookPath(Config.FFmpegPath); err != nil {
|
||||
|
||||
@@ -45,6 +45,7 @@ type ConfigSet struct {
|
||||
FFmpegPath string `yaml:"ffmpeg-path"`
|
||||
ConvertExtraArgs string `yaml:"convert-extra-args"`
|
||||
ConvertWarnLossyToLossless bool `yaml:"convert-warn-lossy-to-lossless"`
|
||||
ConvertSkipLossyToLossless bool `yaml:"convert-skip-lossy-to-lossless"`
|
||||
}
|
||||
|
||||
type Counter struct {
|
||||
|
||||
Reference in New Issue
Block a user