45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -u
|
|
|
|
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
|
|
pause_on_exit() {
|
|
printf '\nPress Return to close this window...'
|
|
read -r _
|
|
}
|
|
trap pause_on_exit EXIT
|
|
|
|
fail() {
|
|
printf '\nError: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
cd "$SCRIPT_DIR" || fail "Could not open the project directory."
|
|
|
|
[ -f ".venv/bin/activate" ] || fail \
|
|
"The virtual environment is missing. Run install.command first."
|
|
|
|
# shellcheck disable=SC1091
|
|
. ".venv/bin/activate"
|
|
|
|
printf 'Enter the radioeins Top-100 overview URL:\n> '
|
|
IFS= read -r OVERVIEW_URL
|
|
[ -n "$OVERVIEW_URL" ] || fail "The URL must not be empty."
|
|
|
|
OUTPUT_DIR="$(python -c 'import sys; from radioeins_top100 import derive_output_dir; print(derive_output_dir(sys.argv[1]).resolve())' "$OVERVIEW_URL")" || fail \
|
|
"Could not determine the output directory."
|
|
|
|
printf '\nStarting evaluation...\n\n'
|
|
python radioeins_top100.py "$OVERVIEW_URL"
|
|
STATUS=$?
|
|
|
|
printf '\nOutput directory: %s\n' "$OUTPUT_DIR"
|
|
if [ "$STATUS" -eq 0 ]; then
|
|
printf 'Evaluation completed successfully.\n'
|
|
else
|
|
printf 'Evaluation finished with errors (exit code %s).\n' "$STATUS" >&2
|
|
fi
|
|
|
|
exit "$STATUS"
|