refactor: standardize indentation in videncode script

This commit is contained in:
dabruh 2025-11-17 20:06:18 +01:00
parent 530c9307d4
commit b1b8ce749b

View file

@ -77,21 +77,67 @@ parse_args() {
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
-i|--input) INFILE="$2"; shift 2 ;; -i | --input)
-o|--output) OUTFILE="$2"; shift 2 ;; INFILE="$2"
-c|--crf) CRF="$2"; shift 2 ;; shift 2
-p|--preset) PRESET="$2"; shift 2 ;; ;;
-m|--maxrate) MAXRATE="$2"; shift 2 ;; -o | --output)
-b|--bufsize) BUFSIZE="$2"; shift 2 ;; OUTFILE="$2"
--extra) EXTRA_ARGS+=("$2"); shift 2 ;; shift 2
--max-w) MAX_W="$2"; shift 2 ;; ;;
--max-h) MAX_H="$2"; shift 2 ;; -c | --crf)
--overwrite-same) OVERWRITE_SAME=true; shift ;; CRF="$2"
--overwrite-different) OVERWRITE_DIFFERENT=true; shift ;; shift 2
--audio-mode) AUDIO_MODE="$2"; shift 2 ;; ;;
-h|--help) usage; exit 0 ;; -p | --preset)
--) shift; break ;; PRESET="$2"
*) echo "Unknown argument: $1" >&2; usage; exit 1 ;; shift 2
;;
-m | --maxrate)
MAXRATE="$2"
shift 2
;;
-b | --bufsize)
BUFSIZE="$2"
shift 2
;;
--extra)
EXTRA_ARGS+=("$2")
shift 2
;;
--max-w)
MAX_W="$2"
shift 2
;;
--max-h)
MAX_H="$2"
shift 2
;;
--overwrite-same)
OVERWRITE_SAME=true
shift
;;
--overwrite-different)
OVERWRITE_DIFFERENT=true
shift
;;
--audio-mode)
AUDIO_MODE="$2"
shift 2
;;
-h | --help)
usage
exit 0
;;
--)
shift
break
;;
*)
echo "Unknown argument: $1" >&2
usage
exit 1
;;
esac esac
done done
} }
@ -170,7 +216,7 @@ build_ffmpeg_cmd() {
# Safely append user-provided extra arguments by splitting on whitespace. # Safely append user-provided extra arguments by splitting on whitespace.
if [[ ${#EXTRA_ARGS[@]} -gt 0 ]]; then if [[ ${#EXTRA_ARGS[@]} -gt 0 ]]; then
for ea in "${EXTRA_ARGS[@]}"; do for ea in "${EXTRA_ARGS[@]}"; do
read -r -a split <<< "$ea" read -r -a split <<<"$ea"
CMD+=("${split[@]}") CMD+=("${split[@]}")
done done
fi fi