]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change: spaces and braces on function
authorBastian Dehn <hhaalo@arcor.de>
Sat, 14 Jul 2018 08:56:01 +0000 (10:56 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 14 Jul 2018 08:56:01 +0000 (10:56 +0200)
albentohandy
flactomp3v2

index 31cf3a8a26af9c68125c97e60f713f60846d9287..75ea17d6ef868050b46e413dabd633b91d419473 100755 (executable)
@@ -4,7 +4,8 @@
 ### copy to other folder. It works on parallel, you can
 ### use it in a cluster with Parameter -S.
 
-Usage() {
+Usage()
+{
        cat <<- EOF
 
 NAME
@@ -30,7 +31,8 @@ OPTIONS
        EOF
 }
 
-MakeSymlinksToWork() {
+MakeSymlinksToWork()
+{
        local readonly workdir="$1"
        local readonly musicdir="$2"
        local readonly albumlist="$3"
@@ -43,7 +45,8 @@ MakeSymlinksToWork() {
 
 }
 
-ConvertFlacToMp3() {
+ConvertFlacToMp3()
+{
        local readonly workdir="$1"
        local readonly basefile="$2"
        local readonly paralleopts="$3"
@@ -57,7 +60,8 @@ ConvertFlacToMp3() {
                $scriptdir/flactomp3v2 {}
 }
 
-CleanupFlac() {
+CleanupFlac()
+{
        local readonly workdir="$1"
 
        find $workdir -name '*.flac' | \
@@ -65,14 +69,16 @@ CleanupFlac() {
                xargs rm
 }
 
-CleanupWorkDir() {
+CleanupWorkDir()
+{
        local readonly workdir="$1"
 
        printf "cleanup working directory\n\n"
        rm --recursive $workdir
 }
 
-CopyWorkDirToDestDir() {
+CopyWorkDirToDestDir()
+{
        local readonly workdir="$1"
        local readonly destdir="$2"
 
@@ -80,7 +86,8 @@ CopyWorkDirToDestDir() {
        cp --recursive $workdir/* $destdir
 }
 
-MakeZipFile() {
+MakeZipFile()
+{
        local readonly workdir="$1"
        local zipname="$2"
 
@@ -94,7 +101,8 @@ MakeZipFile() {
        cd $curpath
 }
 
-MakeSha256CheckSum() {
+MakeSha256CheckSum()
+{
        local readonly workdir="$1"
 
        find $workdir -name '*.mp3' | \
@@ -104,7 +112,8 @@ MakeSha256CheckSum() {
                >> $workdir/sha256sum
 }
 
-ExistsScripts() {
+ExistsScripts()
+{
        local readonly scriptdir="$1"
 
        # flactomp3v2: convert flac's to mp3
@@ -114,7 +123,8 @@ ExistsScripts() {
        fi
 }
 
-LoadConfig() {
+LoadConfig()
+{
        # .albentohandy.conf: set SCRIPTPATH and MUSICPATH
        if [ -f $HOME/.albentohandy.conf ]; then
                source $HOME/.albentohandy.conf
@@ -131,7 +141,8 @@ LoadConfig() {
        fi
 }
 
-ExistsBasicProgramms() {
+ExistsBasicProgramms()
+{
        local exists=true
        local programms=("eyeD3" "flac" "lame" "sha256sum" "7z" "parallel")
 
@@ -147,7 +158,8 @@ ExistsBasicProgramms() {
        fi
 }
 
-SetDefaultVariables() {
+SetDefaultVariables()
+{
        albumlist="albumlist"
        parallelopts=":"
        curphase=1
@@ -158,7 +170,8 @@ SetDefaultVariables() {
        cptodest=false
 }
 
-ReadArguments() {
+ReadArguments()
+{
        while getopts "chi:m:S:rw:z:" optname; do
                case "$optname" in
                "c")
@@ -195,7 +208,8 @@ ReadArguments() {
        done
 }
 
-ExistsAlbumlist() {
+ExistsAlbumlist()
+{
        local albumlist="$1"
 
        if [ ! -f "$albumlist" ]; then
@@ -204,7 +218,8 @@ ExistsAlbumlist() {
        fi
 }
 
-CreateWorkDirectory() {
+CreateWorkDirectory()
+{
        local WORK="$1"
 
        if [ ! -d $WORK ]; then
@@ -212,7 +227,8 @@ CreateWorkDirectory() {
        fi
 }
 
-ConvertProcess() {
+ConvertProcess()
+{
        printf "\nPhase %02d of %02d:\n" $((curphase++)) $phase
        printf "create symlinks of flac's in %s\n" "$WORK"
        MakeSymlinksToWork "$WORK" "$MUSICPATH" "$albumlist"
@@ -225,7 +241,8 @@ ConvertProcess() {
        CleanupFlac "$WORK"
 }
 
-AdvancedFeatures() {
+AdvancedFeatures()
+{
        # create sha256sum in working directory
        if [ $checksum == true ]; then
                printf "Phase %02d of %02d: " $((curphase++)) $phase
@@ -256,7 +273,8 @@ AdvancedFeatures() {
        fi
 }
 
-main() {
+main()
+{
        WORK="$(pwd)/work.$$" # temporary working directory
        SCRIPTPATH="/usr/bin" # path to flactomp3v2 and notify.sh script
        MUSICPATH="/tmp/musikpath" # flac collection directory
@@ -276,5 +294,4 @@ main() {
 }
 
 main $*
-
 exit 0
index 9a52ddc0094be7b7b3625de068fcca3b86729ca1..fb63465f08cb529f75c864cd54415305d2ae8d05 100755 (executable)
@@ -2,19 +2,22 @@
 ### Script converts flac to mp3 and added ID3-Tag
 ### include cover and replaygain Information from flac file
 
-DefaultVariables() {
+DefaultVariables()
+{
        BITRATE=192
        MODE="j"
 }
 
 # config .flactomp3v2.conf can set BITRATE and MODE
-LoadConfigFile() {
+LoadConfigFile()
+{
        if [ -f $HOME/.flactomp3v2.conf ]; then
                source $HOME/.flactomp3v2.conf
        fi
 }
 
-ReadFlacToMp3Tags() {
+ReadFlacToMp3Tags()
+{
        local readonly INPUTFILE="$1"
        local readonly OUTPUTFILE="$2"
        local readonly INPUTFILEDIR=${INPUTFILE%/*}
@@ -73,7 +76,8 @@ ReadFlacToMp3Tags() {
        eval $eyed3Command
 }
 
-EncodingFlacToMp3() {
+EncodingFlacToMp3()
+{
        local readonly INPUTFILE="$1"
        local readonly OUTPUTFILE="$2"
 
@@ -83,7 +87,8 @@ EncodingFlacToMp3() {
                -b $BITRATE -m $MODE --noreplaygain - "$OUTPUTFILE"
 }
 
-main() {
+main()
+{
        local readonly INPUTFILE="$1"
        local readonly OUTPUTFILE="${INPUTFILE[@]/%flac/mp3}"
 
@@ -95,5 +100,4 @@ main() {
 }
 
 main "$1"
-
 exit 0