]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change: all in function flactomp3v2
authorBastian Dehn <hhaalo@arcor.de>
Sat, 25 Nov 2017 07:46:55 +0000 (08:46 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 25 Nov 2017 07:46:55 +0000 (08:46 +0100)
flactomp3v2

index 8e489db1839106716a6a6e63348a1e16743caa04..8242e9da7ea30cb3bf0eacd6c04b65b8d6b2f988 100755 (executable)
@@ -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"
 }