]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add cleanup cover
authorBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 11:15:02 +0000 (13:15 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 25 Sep 2026 11:15:02 +0000 (13:15 +0200)
src/albentohandy
tests/albentohandy.bats

index f76219e0938c2c5fed23bb7ef4d2fffd4d4a96ab..59728961ecf3696f06363d51fea3465c0bd3e00f 100755 (executable)
@@ -70,6 +70,11 @@ make_symlinks_to_work()
        done
 }
 
+cleanup_cover()
+{
+       find "$OUTPUT_PATH" -regex '.*cover\.\(txt\|jpg\)' -exec rm {} \;
+}
+
 main()
 {
        local albumlist="albumlist"
@@ -103,6 +108,9 @@ main()
        encode "$OUTPUT_PATH" \
                || errlog "could not encode $OUTPUT_PATH" \
                || return $?
+       cleanup_cover \
+               || errlog "could not cleanup cover" \
+               || return $?
 }
 
 [ "$TEST_MODE" == "ON" ] && return 0
index 9f44ed967138bc4b0135253041f052b2b99f9227..fc093ff4ad99b49537ea61c7a21b52b98741f859 100755 (executable)
@@ -188,6 +188,10 @@ teardown() {
 }
 
 @test "success: copy cover.jpg for Alben/Artist1" {
+       cleanup_cover() {
+               :
+       }
+
        run main -i "build/tests/albumlist"
 
        assert_success
@@ -226,4 +230,26 @@ teardown() {
 
        assert_failure
        assert_line --index 0 "❌ ERROR: could not encode build/tests/output"
+}
+
+@test "success: cleanup cover" {
+       mkdir --parents "build/tests/output/Artist1/"
+       echo "metadatacover" > "build/tests/output/Artist1/cover.txt"
+
+       run main -i "build/tests/albumlist"
+
+       assert_success
+       [ ! -f "build/tests/output/Artist1/cover.txt" ]
+       [ ! -f "build/tests/output/Artist1/cover.jpg" ]
+}
+
+@test "failed: cleanup cover" {
+       cleanup_cover() {
+               return 1
+       }
+
+       run main -i "build/tests/albumlist"
+
+       assert_failure
+       assert_line --index 0 "❌ ERROR: could not cleanup cover"
 }
\ No newline at end of file