From: Bastian Dehn Date: Sat, 19 Jul 2025 07:55:49 +0000 (+0200) Subject: change only needed lib loaded X-Git-Tag: v1.0.0^2~43 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=6e646507ffa3e8054288f9b756bcb117a8936f79;p=albentohandy.git change only needed lib loaded --- diff --git a/albentohandy b/albentohandy index f1ddbd2..1c43c71 100755 --- a/albentohandy +++ b/albentohandy @@ -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