From c9e9003b12c79f2aa61d8674bbd81c14fb5a6312 Mon Sep 17 00:00:00 2001 From: desktop Date: Tue, 5 Dec 2023 13:02:37 +0300 Subject: [PATCH] transcode : skip existing files. --- .config/bash/module/checksum.sh | 2 -- .config/bash/module/transcode.sh | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.config/bash/module/checksum.sh b/.config/bash/module/checksum.sh index ed5c738..b686ba7 100644 --- a/.config/bash/module/checksum.sh +++ b/.config/bash/module/checksum.sh @@ -95,8 +95,6 @@ checksum_check() echo -e "${color_bred}Failed: ${failed}.${color_default}" return 1 fi - - [[ ${total} = 0 ]] && return 1 } checksum() diff --git a/.config/bash/module/transcode.sh b/.config/bash/module/transcode.sh index 56d278e..0eaae08 100644 --- a/.config/bash/module/transcode.sh +++ b/.config/bash/module/transcode.sh @@ -8,6 +8,7 @@ transcode() local total=${#targets[@]} local count=0 local failed=0 + local skipped=0 # Report no format. if [[ "${format}" = "" ]]; then @@ -37,8 +38,8 @@ transcode() # Show status. echo -e "${status}" - # Skip same format. - # [[ "${from}" = "${to}" ]] && continue + # Skip if file exists. + [[ -f "${output}" ]] && { ((skipped++)); continue; } # Support multiple inputs. [[ "${to}" = "mp3" ]] && from="" @@ -78,6 +79,11 @@ transcode() ((failed++)) fi done + + if [[ ${skipped} != 0 ]]; then + echo -e "${color_byellow}Skipped: ${skipped}.${color_default}" + return 1 + fi if [[ ${failed} != 0 ]]; then echo -e "${color_bred}Failed: ${failed}.${color_default}"