mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-08 13:13:47 -05:00
Fixed XLD audio conversion.
This commit is contained in:
@@ -493,16 +493,17 @@ convertMusic() {
|
|||||||
|
|
||||||
# FLAC TO ALAC
|
# FLAC TO ALAC
|
||||||
if [[ "${userOutput,,}" == "alac" ]]; then
|
if [[ "${userOutput,,}" == "alac" ]]; then
|
||||||
if type_exists "xlds"; then
|
if type_exists "xld"; then
|
||||||
XLD=1
|
XLD=1
|
||||||
# audioConvertCommand="--profile FLACtoALAC"
|
#audioConvertCommand="--profile FLACtoALAC"
|
||||||
audioConvertCommand="-f alac" && verbose "Using XLD. audioConvertCommand = -f alac"
|
audioConvertCommand="-f alac" && verbose "Using XLD. audioConvertCommand = -f alac"
|
||||||
|
outputFormat="m4a"
|
||||||
else
|
else
|
||||||
audioConvertCommand="-acodec alac" && verbose "Using ffmpeg. audioConvertCommand = -acodec alac"
|
audioConvertCommand="-acodec alac" && verbose "Using ffmpeg. audioConvertCommand = -acodec alac"
|
||||||
outputFormat="m4a"
|
outputFormat="m4a"
|
||||||
fi
|
fi
|
||||||
elif [[ "${userOutput,,}" == "flac" ]]; then
|
elif [[ "${userOutput,,}" == "flac" ]]; then
|
||||||
if type_exists "xlds"; then
|
if type_exists "xld"; then
|
||||||
XLD=1
|
XLD=1
|
||||||
audioConvertCommand="-f flac" && verbose "Using XLD. audioConvertCommand = -f flac"
|
audioConvertCommand="-f flac" && verbose "Using XLD. audioConvertCommand = -f flac"
|
||||||
else
|
else
|
||||||
@@ -613,6 +614,7 @@ function doConvert() {
|
|||||||
else
|
else
|
||||||
verbose "xld -o "${output}" ${audioConvertCommand} "${f}""
|
verbose "xld -o "${output}" ${audioConvertCommand} "${f}""
|
||||||
xld -o "${output}" ${audioConvertCommand} "${f}"
|
xld -o "${output}" ${audioConvertCommand} "${f}"
|
||||||
|
deleteOriginalFile
|
||||||
fi
|
fi
|
||||||
else # Use ffmpeg when XLD is set to 0
|
else # Use ffmpeg when XLD is set to 0
|
||||||
# Respect --safe flag.
|
# Respect --safe flag.
|
||||||
@@ -621,21 +623,24 @@ function doConvert() {
|
|||||||
else
|
else
|
||||||
verbose "ffmpeg -i "${f}" ${videoResize} ${videoCommand} ${videoAudioCommand} ${audioConvertCommand} "${output}" ${ffquiet}"
|
verbose "ffmpeg -i "${f}" ${videoResize} ${videoCommand} ${videoAudioCommand} ${audioConvertCommand} "${output}" ${ffquiet}"
|
||||||
ffmpeg -i "${f}" ${videoResize} ${videoCommand} ${videoAudioCommand} ${audioConvertCommand} "${output}" ${ffquiet}
|
ffmpeg -i "${f}" ${videoResize} ${videoCommand} ${videoAudioCommand} ${audioConvertCommand} "${output}" ${ffquiet}
|
||||||
|
deleteOriginalFile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# delete original if requested and remove '.new' from new file
|
}
|
||||||
if ${deleteOriginal}; then
|
|
||||||
rm -f $v "${f}"
|
function deleteOriginalFile() {
|
||||||
#remove '.new' from filename
|
if ${deleteOriginal}; then
|
||||||
if [[ -n "${outputDir}" ]]; then
|
rm -f $v "${f}"
|
||||||
for file in "${outputDir}*.new.*"; do
|
#remove '.new' from filename
|
||||||
rename $v 's/.new//g' "${file}"
|
if [[ -n "${outputDir}" ]]; then
|
||||||
done
|
for file in "${outputDir}*.new.*"; do
|
||||||
else
|
rename $v 's/.new//g' "${file}"
|
||||||
for file in *.new.*; do
|
done
|
||||||
rename $v 's/.new//g' "${file}"
|
else
|
||||||
done
|
for file in *.new.*; do
|
||||||
fi
|
rename $v 's/.new//g' "${file}"
|
||||||
fi
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user