From 742093b18cd31e9d25c43f475b94c232fc28a5a7 Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 11 Sep 2026 18:21:38 -0400 Subject: feat: config.toml added --- producer.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'producer.sh') diff --git a/producer.sh b/producer.sh index c6f2759..f2dc6be 100755 --- a/producer.sh +++ b/producer.sh @@ -35,9 +35,11 @@ usage() { cat <<'USAGE' Producer - local speech cleanup and podcast mastering. -Usage: ./producer.sh COMMAND [options] +Usage: ./producer.sh COMMAND [options], or simply: + ./producer.sh RECORDING.wav... - process RECORDING.wav... Master one or more WAV files + RECORDING.wav... Master one or more WAV files ('process' is optional) + process RECORDING.wav... The same, with the explicit command keyword preview RECORDING.wav Render loudness-matched profile previews config Print resolved settings (TOML, or JSON with --json) doctor Check FFmpeg, data directory and CUDA driver @@ -72,6 +74,31 @@ if [[ ${#ARGS[@]} -eq 1 && ( "${ARGS[0]}" == "-h" || "${ARGS[0]}" == "--help" ) exit 0 fi +# A config.toml next to this script is loaded automatically for every +# command that accepts --config, unless one is given explicitly. Named CLI +# flags and --set still override values from the file. +HAVE_CONFIG=0 +for arg in ${ARGS[@]+"${ARGS[@]}"}; do + case "$arg" in --config|--config=*) HAVE_CONFIG=1 ;; esac +done +if [[ $HAVE_CONFIG -eq 0 && -f "$ROOT/config.toml" ]]; then + case "${ARGS[0]-}" in + # After the command word: the CLI treats a leading non-command + # argument as the implicit 'process' command and then as an input. + process|preview|config) + ARGS=("${ARGS[0]}" "--config=$ROOT/config.toml" "${ARGS[@]:1}") + ;; + # These commands take no --config (or no arguments at all). + doctor|setup|-h|--help|--version|"") + ;; + *) + # Bare inputs or options: the CLI inserts 'process' first, so the + # flag can go in front. + ARGS=("--config=$ROOT/config.toml" ${ARGS[@]+"${ARGS[@]}"}) + ;; + esac +fi + mkdir -p -- "$RUNTIME/cache/pip" "$RUNTIME/cache/uv" "$RUNTIME/uv" "$RUNTIME/tmp" \ || fail "Cannot create the runtime directory under $LIB" -- cgit v1.2.3