From 0fc278fa2687ab9f97ea02f4baaa48a03bf59e97 Mon Sep 17 00:00:00 2001 From: fruchti Date: Sat, 18 Jan 2020 21:42:45 +0100 Subject: [PATCH] =?UTF-8?q?Replace=20backticks=20by=20$(=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transcode.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/transcode.sh b/transcode.sh index 1cde8d0..214f8d6 100644 --- a/transcode.sh +++ b/transcode.sh @@ -9,9 +9,9 @@ function transcode_to_mp3() { input_file="$1" output_directory="$2" - output_file="`echo "$input_file" | sed -E "s#^$input_directory(.+)\\.[a-z0-9]+\\$#$output_directory\\1.mp3#g"`" + output_file="$(echo "$input_file" | sed -E "s#^$input_directory(.+)\\.[a-z0-9]+\\$#$output_directory\\1.mp3#g")" - directory="`dirname "$output_file"`" + directory="$(dirname "$output_file")" if [ ! -d "$directory" ] ; then echo "New Directory: \"$directory\"" mkdir -p "$directory" || { echo "Could not create directory \"$directory\"." ; return 1 ; } @@ -28,10 +28,10 @@ function transcode_to_mp3() fi if [ "$transcode" = true ] ; then - input_type="`file -b --mime-type "$input_file"`" + input_type="$(file -b --mime-type "$input_file")" case "$input_type" in "audio/flac"|"audio/x-flac") - tmp_file="$tmp_directory/`basename "$output_file"`" + tmp_file="$tmp_directory/$(basename "$output_file")" echo "Transcoding MP3..." ffmpeg -hide_banner -loglevel fatal -i "$input_file" -y -b:a 320k -qscale:a 2 -id3v2_version 3 -f mp3 "$tmp_file" || { echo "Failed to transcode to \"$tmp_file\"." ; return 1 ; } mv -f "$tmp_file" "$output_file" || { echo "Could not move file to \"$output_file\"." ; return 1 ; } @@ -61,7 +61,7 @@ function ogg_add_cover() tmp_metafile="$tmp_directory/metadata" tmp_mdimg="$tmp_directory/image-with-header" - cover_mime_type="`file -b --mime-type "$cover_file"`" + cover_mime_type="$(file -b --mime-type "$cover_file")" description="" vorbiscomment --list --raw "$ogg_file" > "$tmp_metafile" && \ @@ -87,9 +87,9 @@ function transcode_to_ogg() { input_file="$1" output_directory="$2" - output_file="`echo "$input_file" | sed -E "s#^$input_directory(.+)\\.[a-z0-9]+\\$#$output_directory\\1.ogg#g"`" + output_file="$(echo "$input_file" | sed -E "s#^$input_directory(.+)\\.[a-z0-9]+\\$#$output_directory\\1.ogg#g")" - directory="`dirname "$output_file"`" + directory="$(dirname "$output_file")" if [ ! -d "$directory" ] ; then echo "New Directory: \"$directory\"" mkdir -p "$directory" || { echo "Could not create directory \"$directory\"." ; return 1 ; } @@ -106,9 +106,9 @@ function transcode_to_ogg() fi if [ "$transcode" = true ] ; then - input_type="`file -b --mime-type "$input_file"`" + input_type="$(file -b --mime-type "$input_file")" - tmp_ogg="$tmp_directory/`basename "$output_file"`" + tmp_ogg="$tmp_directory/$(basename "$output_file")" tmp_cover="$tmp_directory/cover" case "$input_type" in @@ -172,8 +172,8 @@ if [ ! -d "$tmp_directory" ] ; then fi SAVEIFS=$IFS -IFS=`echo -ne "\n\b"` -for file in `find "$input_directory" -name '*.flac' -or -name '*.mp3' | sort`; do +IFS=$(echo -ne "\n\b") +for file in $(find "$input_directory" -name '*.flac' -or -name '*.mp3' | sort); do transcode_to_mp3 "$file" "/data/mp3" || break transcode_to_ogg "$file" "/data/ogg" || break done