]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change lib per param
authorBastian Dehn <hhaalo@arcor.de>
Sun, 27 Sep 2026 15:53:53 +0000 (17:53 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 27 Sep 2026 15:53:53 +0000 (17:53 +0200)
src/albentohandy
src/man/albentohandy.1
tests/albentohandy.bats

index e9dc606b4f9a23044ca557a97922ae5c0fc3f843..24f7fb70646139902642c099bbf0b449deb4c221 100755 (executable)
@@ -16,11 +16,9 @@ useage()
        echo "SYNOPSIS"
        echo "    albentohandy [-3fho] [-i <albumlist>]"
        echo "OPTIONS"
-       echo "    -3              convert to mp3"
-       echo "    -f              convert to flac with cover"
        echo "    -h              show this usage"
        echo "    -i <albumlist>  optional input list (default albumlist)"
-       echo "    -o              convert to opus"
+       echo "    -l <library>    lib [vorbis|mp3|opus|flac|<custom>]"
 }
 
 check_programs()
@@ -138,13 +136,11 @@ main()
        check_programs || return $?
        load_config || return $?
 
-       while getopts "3fhi:o" opt; do
+       while getopts "hi:l:" opt; do
                case "$opt" in
-               "3") lib="mp3.sh" ;;
-               "f") lib="flac.sh" ;;
                "h") useage && return 0 ;;
                "i") albumlist="$OPTARG" ;;
-               "o") lib="opus.sh" ;;
+               "l") lib="$OPTARG.sh" ;;
                *) errlog "unknown option" && useage && return 1 ;;
                esac
        done
index f5845528c2d13dc6311bf3dd61f571fd588241f7..abeaab2b32bff81b0b7864a80d65bac6761104bb 100644 (file)
@@ -9,10 +9,12 @@ albentohandy [-3fho] [-i <albumlist>]
 .SH OPTIONS
 .P
 .EX
--3              convert to mp3
--f              convert to flac with cover"
 -h              show this usage"
 -i <albumlist>  optional input list (default albumlist)
--o              convert to opus"
+-l <library>    lib [vorbis|mp3|opus|flac|<custom>]
+                you can add custom lib
+                is install deb under /usr/lib/albentohandy
+                (e.g. /usr/lib/albentohandy/custom.sh)
+                or add on source src/lib (e.g. src/lib/custom.sh)
 .EE
 .P
\ No newline at end of file
index 67a0f85df521fbfc1a584d37402b380eb1f29197..9ca4fdaa62054257e7a46f369d11ceec1204dd46 100755 (executable)
@@ -113,6 +113,19 @@ 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 vorbis.sh not found with param" {
+       load_config() {
+               :
+       }
+       LIB_PATH="build/tests/lib1"
+
+       run main -l vorbis
+
+       assert_failure
+       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" {
        load_config() {
@@ -120,7 +133,7 @@ teardown() {
        }
        LIB_PATH="build/tests/lib"
 
-       run main -3
+       run main -l mp3
 
        assert_failure
        assert_line --index 0 "❌ ERROR: lib build/tests/lib/mp3.sh not found"
@@ -133,7 +146,7 @@ teardown() {
        }
        LIB_PATH="build/tests/lib"
 
-       run main -f
+       run main -l flac
 
        assert_failure
        assert_line --index 0 "❌ ERROR: lib build/tests/lib/flac.sh not found"
@@ -146,7 +159,7 @@ teardown() {
        }
        LIB_PATH="build/tests/lib"
 
-       run main -o
+       run main -l opus
 
        assert_failure
        assert_line --index 0 "❌ ERROR: lib build/tests/lib/opus.sh not found"
@@ -499,7 +512,7 @@ teardown() {
        mkdir --parents "build/tests/output/Artist1"
        echo "testfile" > "build/tests/output/Artist1/file.flac"
 
-       run main -i "build/tests/albumlist" -f
+       run main -i "build/tests/albumlist" -l flac
 
        assert_success
        [ -f "build/tests/output/Artist1/file.flac" ]
@@ -529,7 +542,7 @@ teardown() {
                return 1
        }
 
-       run main -i "build/tests/albumlist" -f
+       run main -i "build/tests/albumlist" -l flac
 
        assert_failure
        assert_line --index 0 "❌ ERROR: could not cleanup flac"
@@ -595,11 +608,10 @@ teardown() {
        assert_line --index 2 "SYNOPSIS"
        assert_line --index 3 "    albentohandy [-3fho] [-i <albumlist>]"
        assert_line --index 4 "OPTIONS"
-       assert_line --index 5 "    -3              convert to mp3"
-       assert_line --index 6 "    -f              convert to flac with cover"
-       assert_line --index 7 "    -h              show this usage"
-       assert_line --index 8 "    -i <albumlist>  optional input list (default albumlist)"
-       assert_line --index 9 "    -o              convert to opus"
+       assert_line --index 5 "    -h              show this usage"
+       assert_line --index 6 "    -i <albumlist>  optional input list (default albumlist)"
+       assert_line --index 7 "    -l <library>    lib [vorbis|mp3|opus|flac|<custom>]"
+
 }
 
 # bats test_tags=albentohandy:usage
@@ -617,9 +629,7 @@ teardown() {
        assert_line --index 4 "SYNOPSIS"
        assert_line --index 5 "    albentohandy [-3fho] [-i <albumlist>]"
        assert_line --index 6 "OPTIONS"
-       assert_line --index 7 "    -3              convert to mp3"
-       assert_line --index 8 "    -f              convert to flac with cover"
-       assert_line --index 9 "    -h              show this usage"
-       assert_line --index 10 "    -i <albumlist>  optional input list (default albumlist)"
-       assert_line --index 11 "    -o              convert to opus"
+       assert_line --index 7 "    -h              show this usage"
+       assert_line --index 8 "    -i <albumlist>  optional input list (default albumlist)"
+       assert_line --index 9 "    -l <library>    lib [vorbis|mp3|opus|flac|<custom>]"
 }
\ No newline at end of file