make ffmpeg not read from stdin and check output of ffmpeg
This commit is contained in:
@@ -15,10 +15,14 @@ function fix_flac_file()
|
|||||||
|
|
||||||
echo "running command ffmpeg -i $1 -c:a flac -map_metadata 0 fixed.flac"
|
echo "running command ffmpeg -i $1 -c:a flac -map_metadata 0 fixed.flac"
|
||||||
|
|
||||||
ffmpeg -i "$1" -c:a flac -map_metadata 0 "fixed.flac"
|
if ffmpeg -nostdin -i "$1" -c:a flac -map_metadata 0 fixed.flac
|
||||||
|
then
|
||||||
echo "moving fixed.flac to $1"
|
echo "Moving fixed.flac to $1"
|
||||||
mv "fixed.flac" "$1"
|
mv fixed.flac "$1"
|
||||||
|
else
|
||||||
|
echo "Failed to process $1" >&2
|
||||||
|
rm -f fixed.flac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_help()
|
function print_help()
|
||||||
@@ -51,7 +55,8 @@ else
|
|||||||
if [ "$1" = "-l" ]
|
if [ "$1" = "-l" ]
|
||||||
then
|
then
|
||||||
echo "Looping through $2"
|
echo "Looping through $2"
|
||||||
while read flacfile; do
|
# Use IFS= and -r with read so backslashes and leading/trailing whitespace are preserved
|
||||||
|
while IFS= read -r flacfile; do
|
||||||
echo "Processing line $flacfile"
|
echo "Processing line $flacfile"
|
||||||
fix_flac_file "$flacfile"
|
fix_flac_file "$flacfile"
|
||||||
done < "$2"
|
done < "$2"
|
||||||
|
|||||||
Reference in New Issue
Block a user