diff options
Diffstat (limited to '')
| -rwxr-xr-x | transcode.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/transcode.sh b/transcode.sh index 15dba25..500111d 100755 --- a/transcode.sh +++ b/transcode.sh @@ -557,6 +557,11 @@ if [[ $SAVING -eq 1 ]]; then } fi +if [[ ! "$NICE_VALUE" =~ ^-?[0-9]+$ ]] || ((NICE_VALUE < -20 || NICE_VALUE > 19)); then + error "Invalid nice value (must be an integer between -20 and 19):" "$NICE_VALUE" + exit $EXIT_USAGE_ERROR +fi + # Remove temporary output files created during encoding. # Registered via trap EXIT so it runs on normal exit and on failures # shellcheck disable=SC2329 @@ -584,11 +589,16 @@ trap cleanup EXIT # EXIT_OK on success or if skipped; EXIT_RUNTIME_FAILURE on failure. encode_one() { local file="$1" - msg "Processing:" "$file" [[ -z "$file" ]] && return $EXIT_OK + + msg "Processing:" "$file" [[ ! -f "$file" ]] && { - error "Not found" + error "Not found:" "$file" + return $EXIT_RUNTIME_FAILURE + } + [[ ! -r "$file" ]] && { + error "File is not readable:" "$file" return $EXIT_RUNTIME_FAILURE } @@ -752,6 +762,10 @@ encode_one() { STATUS=$EXIT_OK if [[ -n $ENCODE_FILE ]]; then + [[ -f "$ENCODE_FILE" ]] || { + error "Encode file not found:" "$ENCODE_FILE" + exit $EXIT_USAGE_ERROR + } while IFS= read -r file || [[ -n "$file" ]]; do encode_one "$file" || STATUS=$EXIT_RUNTIME_FAILURE done <"$ENCODE_FILE" |
