From 19dec430cfc23cd6e1343098710257a85ae901c7 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 2 Aug 2025 16:09:01 -0700 Subject: [PATCH] Give the correct error when the conversion is skipped due to the temp file already existing. --- refactor_music_library.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/refactor_music_library.sh b/refactor_music_library.sh index d7cb9f3..c8b54d8 100755 --- a/refactor_music_library.sh +++ b/refactor_music_library.sh @@ -268,20 +268,24 @@ find "$OLD_DIR" -type f ! -name "*".$EXT | sort | while read non_mp3; do temp_file="$INT_DIR/${temp_file//[^[:alnum:][:space:].]/}.$EXT" echo "temp_file='$temp_file'" - status="" - if [[ ! -s "$temp_file" ]]; then - # Actual conversion. - ffmpeg -y \ - -nostdin -hide_banner -loglevel quiet \ - -i "$non_mp3" "$temp_file" - status="$?" + if [[ -s "$temp_file" ]]; then + echo "*** FAILED: Temporary file already exists!" + echo "**** Please remove any failed previous runs." + exit 1 fi + # Actual conversion. + status="" + ffmpeg -y \ + -nostdin -hide_banner -loglevel quiet \ + -i "$non_mp3" "$temp_file" + status="$?" + if [[ $status != 0 ]]; then echo "*** FAILED: Exited with status '$status'." echo "**** To troubleshoot, try running this:" echo "ffmpeg -y -i \"$non_mp3\" \"$temp_file\"" - exit + exit 1 fi echo "*** Success!"