]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
refactor call programm
authorBastian Dehn <hhaalo@arcor.de>
Sun, 23 Aug 2026 06:17:09 +0000 (08:17 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 23 Aug 2026 06:17:09 +0000 (08:17 +0200)
albentohandy

index 4e0aca90c05fd18600369386b9d569a0052c34d2..9ef9f0cfa8df916f8196ce7ec38ea2e66fb282d4 100755 (executable)
@@ -108,7 +108,8 @@ execute_program()
 {
        local lib="$1"
        local workdir="$2"
-       local scriptpath=$(dirname $(realpath "$0"))
+       local scriptpath=
+       scriptpath=$(dirname "$(realpath "$0")")
 
        [ -f "$scriptpath/libs/$lib" ] \
                || errlog "file $scriptpath/libs/$lib does not exists" \
@@ -130,20 +131,14 @@ convert_process()
                || errlog "file albumlist does not exists" \
                || return $?
 
-       case "$format" in
-       "mp3") execute_program "mp3.sh" "$workdir" || return $? ;;
-       "flac") execute_program "flac.sh" "$workdir" || return $? ;;
-       "opus") execute_program "opus.sh" "$workdir" || return $? ;;
-       *) execute_program "vorbis.sh" "$workdir" || return $? ;;
-       esac
-
-       cleanup_cover "$workdir"
+       execute_program "$format.sh" "$workdir" || return $?
+       cleanup_cover "$workdir" || return $?
        [ "$format" != "flac" ] && cleanup_flac "$workdir"
 }
 
 main()
 {
-       local format=
+       local format=${format:="vorbis"}
 
        check_programms || return $?
        load_config || return $?