From 19a8c70e793f4e4c4079ba669a9fb2bc9d718427 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 25 Nov 2017 08:46:55 +0100 Subject: [PATCH] change: all in function flactomp3v2 --- flactomp3v2 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/flactomp3v2 b/flactomp3v2 index 8e489db..8242e9d 100755 --- a/flactomp3v2 +++ b/flactomp3v2 @@ -2,15 +2,17 @@ ### Script converts flac to mp3 and added ID3-Tag ### include cover and replaygain Information from flac file -# Default options -BITRATE=192 -MODE="j" +DefaultVariables() { + BITRATE=192 + MODE="j" +} -# check config exists # config .flactomp3v2.conf can set BITRATE and MODE -if [ -f $HOME/.flactomp3v2.conf ]; then - source $HOME/.flactomp3v2.conf -fi +LoadConfigFile() { + if [ -f $HOME/.flactomp3v2.conf ]; then + source $HOME/.flactomp3v2.conf + fi +} ReadFlacToMp3Tags() { local readonly INPUTFILE="$1" @@ -66,6 +68,9 @@ main() { local readonly INPUTFILE="$1" local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/mp3}" + DefaultVariables + LoadConfigFile + EncodingFlacToMp3 "$INPUTFILE" "$OUTPUTFILE" ReadFlacToMp3Tags "$INPUTFILE" "$OUTPUTFILE" } -- 2.47.3