From f47b59167986789305fc209c75205290492145a6 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sun, 24 May 2026 21:27:11 +0200 Subject: refactor(skip): inline skip codec parsing Fold single-token skip codec handling into parse_skip_codec_parameter so list splitting, normalization, empty-token handling, and duplicate checks live in one place. This removes an extra helper that was only used by the parser while preserving the same comma, space, and colon separated skip-list behavior. --- transcode.sh | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/transcode.sh b/transcode.sh index fe18b0d..bc62cb3 100755 --- a/transcode.sh +++ b/transcode.sh @@ -703,32 +703,29 @@ function load_config() { # CODEC SKIP-LIST HANDLING ############################################################################### -# Add a codec name to the SKIP_CODECS associative array. -# - Normalizes to lowercase +# Parse a user-provided codec list and add each token to SKIP_CODECS. +# Separators: comma, space, or colon. +# - Normalizes tokens to lowercase # - Ignores empty tokens +# - Avoids duplicate entries # - Used both for CLI --skip-codec and for codecs defined in the config file -function add_skip_codec_token() { - local token="${1,,}" # lowercase - - if [[ -z "$token" ]]; then - return 0 - fi - - if [[ ! -v SKIP_CODECS["$token"] ]]; then - debug "Add to skip codec:" "$token" - SKIP_CODECS["$token"]= - else - debug "Codec already skipped:" "$token" - fi -} - -# Parse a user-provided codec list (comma/space/colon separated) -# and add each token to SKIP_CODECS function parse_skip_codec_parameter() { local arg="$1" local IFS=',: ' token + for token in $arg; do - add_skip_codec_token "$token" + token=${token,,} # lowercase + + if [[ -z "$token" ]]; then + continue + fi + + if [[ -v SKIP_CODECS["$token"] ]]; then + debug "Codec already skipped:" "$token" + else + debug "Add to skip codec:" "$token" + SKIP_CODECS["$token"]= + fi done } -- cgit v1.3.1