diff options
| author | Dennis Fink | 2026-05-24 21:27:11 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-05-24 21:27:11 +0200 |
| commit | f47b59167986789305fc209c75205290492145a6 (patch) | |
| tree | 1f8ed4dcbeb6c1669f994d56a8d713da71c60ff7 | |
| parent | 8804eba7a519bccc6c0ae6b90d666d4e1c09eaf0 (diff) | |
| download | transcode.sh-f47b59167986789305fc209c75205290492145a6.tar.gz transcode.sh-f47b59167986789305fc209c75205290492145a6.zip | |
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.
Diffstat (limited to '')
| -rwxr-xr-x | transcode.sh | 37 |
1 files 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 } |
