From: Bastian Dehn Date: Thu, 29 Oct 2026 09:38:13 +0000 (+0100) Subject: add default lib variable X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=069e6350c2ed8af60d92205d102a7f9b337f045a;p=albentohandy.git add default lib variable --- diff --git a/src/albentohandy b/src/albentohandy index b1821ef..7a95d49 100755 --- a/src/albentohandy +++ b/src/albentohandy @@ -138,7 +138,7 @@ calc_checksum() main() { local albumlist="albumlist" - local lib="vorbis.sh" + local lib="${DEFAULT_LIB:="vorbis"}.sh" check_programs || return $? load_config || return $? diff --git a/src/albentohandy.conf b/src/albentohandy.conf index f546afc..a4fd75d 100644 --- a/src/albentohandy.conf +++ b/src/albentohandy.conf @@ -1,6 +1,7 @@ #!/bin/bash MUSIC_PATH="$HOME/Music" +# DEFAULT_LIB="vorbis" # BITRATE="192" # QUALITY="6" # OUTPUT_PATH= diff --git a/tests/albentohandy.bats b/tests/albentohandy.bats index 26ae608..3134514 100755 --- a/tests/albentohandy.bats +++ b/tests/albentohandy.bats @@ -113,6 +113,20 @@ teardown() { assert_line --index 0 "❌ ERROR: lib build/tests/lib1/vorbis.sh not found" } +# bats test_tags=albentohandy:load_library,albentohandy:options +@test "failed: lib mp3.sh not found when default mp3" { + load_config() { + : + } + LIB_PATH="build/tests/lib1" + DEFAULT_LIB="mp3" + + run main + + assert_failure + assert_line --index 0 "❌ ERROR: lib build/tests/lib1/mp3.sh not found" +} + # bats test_tags=albentohandy:load_library,albentohandy:options @test "failed: lib vorbis.sh not found with param" { load_config() {