]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change only needed lib loaded
authorBastian Dehn <hhaalo@arcor.de>
Sat, 19 Jul 2025 07:55:49 +0000 (09:55 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 19 Jul 2025 07:55:49 +0000 (09:55 +0200)
albentohandy

index f1ddbd2161f26f0adca2daa4de92f047828319d5..1c43c71df5e1849563c009f0b823eaa53923969c 100755 (executable)
@@ -30,30 +30,6 @@ OPTIONS
        EOF
 }
 
-load_libraries()
-{
-       [ -n "$LIBS" ] \
-               || errlog "missing LIBS" \
-               || return $?
-       [ -f "$LIBS/voribs.sh" ] \
-               || errlog "library vorbis.sh not found" \
-               || return $?
-       [ -f "$LIBS/mp3.sh" ] \
-               || errlog "library mp3.sh not found" \
-               || return $?
-       [ -f "$LIBS/opus.sh" ] \
-               || errlog "library opus.sh not found" \
-               || return $?
-       [ -f "$LIBS/flac.sh" ] \
-               || errlog "library flac.sh not found" \
-               || return $?
-
-       source "$LIBS/voribs.sh" || return $?
-       source "$LIBS/mp3.sh" || return $?
-       source "$LIBS/opus.sh" || return $?
-       source "$LIBS/flac.sh" || return $?
-}
-
 cleanup_flac()
 {
        local workdir="$1"
@@ -141,10 +117,34 @@ convert_process()
                || return $?
 
        case "$format" in
-       "mp3") convert_flac_to_mp3 "$workdir" ;;
-       "flac") picture_to_flac "$workdir" ;;
-       "opus") convert_flac_to_opus "$workdir" ;;
-       *) convert_flac_to_ogg "$workdir" ;;
+       "mp3")
+               [ -f "$LIBS/mp3.sh" ] \
+                       || errlog "file $LIBS/mp3.sh does not exists" \
+                       || return $?
+               source "$LIBS/mp3.sh" || return $?
+               convert_flac_to_mp3 "$workdir" || return $?
+               ;;
+       "flac")
+               [ -f "$LIBS/flac.sh" ] \
+                       || errlog "file $LIBS/mp3.sh does not exists" \
+                       || return $?
+               source "$LIBS/flac.sh" || return $?
+               picture_to_flac "$workdir"
+               ;;
+       "opus")
+               [ -f "$LIBS/opus.sh" ] \
+                       || errlog "file $LIBS/mp3.sh does not exists" \
+                       || return $?
+               source "$LIBS/opus.sh" || return $?
+               convert_flac_to_opus "$workdir"
+               ;;
+       *)
+               [ -f "$LIBS/voribs.sh" ] \
+                       || errlog "file $LIBS/mp3.sh does not exists" \
+                       || return $?
+               source "$LIBS/voribs.sh" || return $?
+               convert_flac_to_ogg "$workdir" || return $?
+               ;;
        esac
 
        cleanup_cover "$workdir"
@@ -157,11 +157,13 @@ main()
 
        check_programms || return $?
        load_config || return $?
-       load_libraries || return $?
 
        [ -n "$MUSICPATH" ] \
                || errlog "missing MUSICPATH" \
                || return $?
+       [ -n "$LIBS" ] \
+               || errlog "missing LIBS" \
+               || return $?
 
        cover=false