From e9f1c118f634c62b59a41bac464088d4135d07b6 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 3 Jul 2026 18:40:37 +0200 Subject: [PATCH] fix shellcheck issues mp3.sh --- libs/mp3.sh | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/libs/mp3.sh b/libs/mp3.sh index b419465..ce69fc9 100644 --- a/libs/mp3.sh +++ b/libs/mp3.sh @@ -1,31 +1,43 @@ +#!/bin/bash + read_flac_to_mp3_tags() { local inputfile="$1" local outputfile="$2" local inputfiledir=${inputfile%/*} + local ARTIST= + local TITLE= + local GENRE= + local TRACKNUMBER= + local DATE= + local RRL= + local RTG= + local RTP= + local RAG= + local RAP= # get the tags from flac file - local readonly ARTIST=$(metaflac "$inputfile" \ + ARTIST=$(metaflac "$inputfile" \ --show-tag=ARTIST | sed s/.*=//g) - local readonly TITLE=$(metaflac "$inputfile" \ + TITLE=$(metaflac "$inputfile" \ --show-tag=TITLE | sed s/.*=//g) - local readonly ALBUM=$(metaflac "$inputfile" \ + ALBUM=$(metaflac "$inputfile" \ --show-tag=ALBUM | sed s/.*=//g) - local readonly GENRE=$(metaflac "$inputfile" \ + GENRE=$(metaflac "$inputfile" \ --show-tag=GENRE | sed s/.*=//g) - local readonly TRACKNUMBER=$(metaflac "$inputfile" \ + TRACKNUMBER=$(metaflac "$inputfile" \ --show-tag=TRACKNUMBER | sed s/.*=//g) - local readonly DATE=$(metaflac "$inputfile" \ + DATE=$(metaflac "$inputfile" \ --show-tag=DATE | sed s/.*=//g) - local readonly RRL=$(metaflac "$inputfile" \ + RRL=$(metaflac "$inputfile" \ --show-tag=REPLAYGAIN_REFERENCE_LOUDNESS | tr '=' ':') - local readonly RTG=$(metaflac "$inputfile" \ + RTG=$(metaflac "$inputfile" \ --show-tag=REPLAYGAIN_TRACK_GAIN | tr '=' ':') - local readonly RTP=$(metaflac "$inputfile" \ + RTP=$(metaflac "$inputfile" \ --show-tag=REPLAYGAIN_TRACK_PEAK | tr '=' ':') - local readonly RAG=$(metaflac "$inputfile" \ + RAG=$(metaflac "$inputfile" \ --show-tag=REPLAYGAIN_ALBUM_GAIN | tr '=' ':') - local readonly RAP=$(metaflac "$inputfile" \ + RAP=$(metaflac "$inputfile" \ --show-tag=REPLAYGAIN_ALBUM_PEAK | tr '=' ':') # -------------------------------------------------- @@ -50,8 +62,8 @@ read_flac_to_mp3_tags() encoding_flac_to_mp3() { - local readonly inputfile="$1" - local readonly outputfile="$2" + local inputfile="$1" + local outputfile="$2" nice --adjustment=10 flac --totally-silent --stdout --decode \ "$inputfile" \ @@ -77,7 +89,7 @@ convert_flac_to_mp3() export -f flac_to_mp3 export -f encoding_flac_to_mp3 export -f read_flac_to_mp3_tags - find $workdir -name '*.flac' \ + find "$workdir" -name '*.flac' \ | sort \ | parallel --will-cite \ --ungroup \ -- 2.47.3