From d66be45d01cc44d3d34a7acfcf1ba45e7328fb26 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 18 Jul 2025 16:08:28 +0200 Subject: [PATCH] change check programs by load libs --- albentohandy | 32 ++++---------------------------- libs/flac.sh | 9 +++++++++ libs/mp3.sh | 18 ++++++++++++++++++ libs/opus.sh | 12 ++++++++++++ libs/voribs.sh | 21 +++++++++++++++++++++ 5 files changed, 64 insertions(+), 28 deletions(-) diff --git a/albentohandy b/albentohandy index 4ffd455..f1ddbd2 100755 --- a/albentohandy +++ b/albentohandy @@ -48,10 +48,10 @@ load_libraries() || errlog "library flac.sh not found" \ || return $? - source "$LIBS/voribs.sh" - source "$LIBS/mp3.sh" - source "$LIBS/opus.sh" - source "$LIBS/flac.sh" + source "$LIBS/voribs.sh" || return $? + source "$LIBS/mp3.sh" || return $? + source "$LIBS/opus.sh" || return $? + source "$LIBS/flac.sh" || return $? } cleanup_flac() @@ -122,30 +122,6 @@ load_config() check_programms() { - command -v flac > /dev/null \ - || errlog "command flac not found" \ - || return $? - command -v metaflac > /dev/null \ - || errlog "command metaflac not found" \ - || return $? - command -v oggenc > /dev/null \ - || errlog "command oggenc not found" \ - || return $? - command -v lame > /dev/null \ - || errlog "command lame not found" \ - || return $? - command -v opusenc > /dev/null \ - || errlog "command opusenc not found" \ - || return $? - command -v vorbiscomment > /dev/null \ - || errlog "command vorbiscomment not found" \ - || return $? - command -v eyeD3 > /dev/null \ - || errlog "command eyeD3 not found" \ - || return $? - command -v parallel > /dev/null \ - || errlog "command parallel not found" \ - || return $? command -v rsync > /dev/null \ || errlog "command rsync not found" \ || return $? diff --git a/libs/flac.sh b/libs/flac.sh index f07d0d5..8772bb1 100644 --- a/libs/flac.sh +++ b/libs/flac.sh @@ -10,3 +10,12 @@ picture_to_flac() $file done } + +check_flac_programs() +{ + command -v metaflac > /dev/null \ + || errlog "command metaflac not found" \ + || return $? +} + +check_flac_programs diff --git a/libs/mp3.sh b/libs/mp3.sh index c8e7be0..f8f0d4f 100644 --- a/libs/mp3.sh +++ b/libs/mp3.sh @@ -85,3 +85,21 @@ convert_flac_to_mp3() --progress \ flac_to_mp3 {} } + +check_mp3_programs() +{ + command -v flac > /dev/null \ + || errlog "command flac not found" \ + || return $? + command -v lame > /dev/null \ + || errlog "command lame not found" \ + || return $? + command -v eyeD3 > /dev/null \ + || errlog "command eyeD3 not found" \ + || return $? + command -v parallel > /dev/null \ + || errlog "command parallel not found" \ + || return $? +} + +check_mp3_programs diff --git a/libs/opus.sh b/libs/opus.sh index 443a79b..81a954b 100644 --- a/libs/opus.sh +++ b/libs/opus.sh @@ -21,3 +21,15 @@ convert_flac_to_opus() --progress \ flac_to_opus {} } + +check_opus_programs() +{ + command -v opusenc > /dev/null \ + || errlog "command opusenc not found" \ + || return $? + command -v parallel > /dev/null \ + || errlog "command parallel not found" \ + || return $? +} + +check_opus_programs diff --git a/libs/voribs.sh b/libs/voribs.sh index 09940dc..673cf8d 100644 --- a/libs/voribs.sh +++ b/libs/voribs.sh @@ -89,3 +89,24 @@ convert_flac_to_ogg() | parallel --will-cite --ungroup --eta --progress \ flac_to_vorbis "{}" } + +check_vorbis_programs() +{ + command -v flac > /dev/null \ + || errlog "command flac not found" \ + || return $? + command -v metaflac > /dev/null \ + || errlog "command metaflac not found" \ + || return $? + command -v oggenc > /dev/null \ + || errlog "command oggenc not found" \ + || return $? + command -v vorbiscomment > /dev/null \ + || errlog "command vorbiscomment not found" \ + || return $? + command -v parallel > /dev/null \ + || errlog "command parallel not found" \ + || return $? +} + +check_vorbis_programs -- 2.47.3