]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
fix shellcheck issues albentohandy
authorBastian Dehn <hhaalo@arcor.de>
Fri, 3 Jul 2026 12:26:28 +0000 (14:26 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 3 Jul 2026 12:26:28 +0000 (14:26 +0200)
albentohandy

index 28df819b7954e3754a07a2c8963a80d2493f1016..2d8bb9a3f7448f27fd1878b3f2f116bf2fd4ec0f 100755 (executable)
@@ -38,7 +38,7 @@ cleanup_flac()
                || errlog "missing workdir could not cleanup" \
                || return $?
 
-       find $workdir -name '*.flac' -exec rm {} \;
+       find "$workdir" -name '*.flac' -exec rm {} \;
 }
 
 cleanup_cover()
@@ -49,12 +49,12 @@ cleanup_cover()
                || errlog "missing workdir could not cleanup" \
                || return $?
 
-       find $workdir -name 'cover.txt' -exec rm {} \;
+       find "$workdir" -name 'cover.txt' -exec rm {} \;
 
        [ "$cover" == "false" ] \
                || return 0
 
-       find $WORKDIR -name 'cover.jpg' -exec rm {} \;
+       find "$workdir" -name 'cover.jpg' -exec rm {} \;
 }
 
 make_symlinks_to_work()
@@ -63,14 +63,14 @@ make_symlinks_to_work()
        local workdir="$2"
        local musicpath="$3"
 
-       for album in $(cat $albumlist); do
+       while IFS= read -r album; do
                [ -d "$musicpath/$album" ] \
                        || errlog "directory $musicpath/$album does not exists" \
                        || return $?
                cp --recursive \
                        --symbolic-link \
-                       $musicpath/$album \
-                       $workdir \
+                       "$musicpath/$album" \
+                       "$workdir" \
                        || errlog "could not copy symlinks from $musicpath/$album" \
                        || return $?
                rsync --recursive \
@@ -80,11 +80,11 @@ make_symlinks_to_work()
                        --owner \
                        --exclude="*.flac" \
                        --include="cover.jpg" \
-                       $musicpath/$album \
-                       $workdir \
+                       "$musicpath/$album" \
+                       "$workdir" \
                        || errlog "could not copy etc like cover" \
                        || return $?
-       done
+       done < "$albumlist"
 }
 
 load_config()
@@ -93,7 +93,8 @@ load_config()
                || errlog "file $HOME/.albentohandy.conf does not exists" \
                || return $?
 
-       source $HOME/.albentohandy.conf
+       # shellcheck disable=SC1091
+       source "$HOME/.albentohandy.conf"
 }
 
 check_programms()
@@ -111,6 +112,7 @@ execute_program()
        [ -f "$LIBS/$lib" ] \
                || errlog "file $LIBS/$lib does not exists" \
                || return $?
+       # shellcheck disable=SC1090
        source "$LIBS/$lib" || return $?
 
        mkdir -p "$workdir"
@@ -154,17 +156,18 @@ main()
 
        cover=false
 
-       while getopts "3cfg:hi:m:orw:" optname; do
+       while getopts "3cfho" optname; do
                case "$optname" in
                "3") format="mp3" ;;
                "c") cover=true ;;
                "f") format="flac" ;;
                "h") Usage && return 0 ;;
                "o") format="opus" ;;
+               "*") echo "unkwnon parameter" ;;
                esac
        done
 
        convert_process "$format" || return $$
 }
 
-main $*
+main "$@"