aboutsummaryrefslogtreecommitdiff
path: root/producer.sh
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-11 18:21:38 -0400
committerhistoria <historiavg@proton.me>2026-09-11 18:21:38 -0400
commit742093b18cd31e9d25c43f475b94c232fc28a5a7 (patch)
tree056cc617f2e32cd1d43fcf681728ece4df8af6b2 /producer.sh
parent3eccf822e14f5f4dd1f6b96e785c0217db647c3e (diff)
downloadproducer-742093b18cd31e9d25c43f475b94c232fc28a5a7.tar.gz
feat: config.toml added
Diffstat (limited to 'producer.sh')
-rwxr-xr-xproducer.sh31
1 files changed, 29 insertions, 2 deletions
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"