From 349e735c040fd0bf0e9004ebffec21da10d406b6 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 19 Mar 2025 13:08:10 -0700 Subject: [PATCH] Skip conversion if file is still present from a previous run. --- refactor_music_library.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/refactor_music_library.sh b/refactor_music_library.sh index fd6720b..60da58f 100755 --- a/refactor_music_library.sh +++ b/refactor_music_library.sh @@ -84,8 +84,15 @@ find "$OLD_DIR" -type f ! -name "*".mp3 | sort | while read file; do TEMP_FILE="${TEMP_FILE//[^[:alnum:][:space:].]/}" echo "$TEMP_FILE" - ffmpeg -y -nostdin -hide_banner -loglevel quiet -i "$file" \ - "${file//$OLD/$INT}".mp3 + if [[ -s "$TEMP_DIR/$TEMP_FILE" ]]; then + echo "*** Skipping file, already exists!" + continue + fi + + # Actual conversion. + ffmpeg -y \ + -nostdin -hide_banner -loglevel quiet \ + -i "$file" "${file//$OLD/$INT}".mp3 status="$?" if [[ $status != 0 ]]; then echo "*** FAILED: Exited with status '$status'."