Files

50 lines
1.2 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
#
# start_lektor_ui.sh — launch the lektor_ai voiceover queue UI.
#
# Picks a Python that actually has tkinter. The system one is preferred: its Tk
# is built against fontconfig and renders real fonts, while the miniforge build
# only carries legacy X11 bitmap fonts and looks dated. Either will run.
#
# ComfyUI needs to be running for GENERATE to do anything — start_comfyui.sh.
#
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")"
if [[ ! -f ui.py ]]; then
echo "ui.py not found next to this script ($PWD)" >&2
exit 1
fi
# Preference order, best-looking first.
CANDIDATES=(
/usr/bin/python3
python3
"$HOME/miniforge3/bin/python"
"$HOME/miniforge3/envs/comfy-tts/bin/python"
)
PY=""
for c in "${CANDIDATES[@]}"; do
if command -v "$c" >/dev/null 2>&1 && "$c" -c "import tkinter" >/dev/null 2>&1; then
PY="$c"
break
fi
done
if [[ -z "$PY" ]]; then
cat >&2 <<'EOF'
No Python with tkinter was found.
Install it for the system Python (recommended — gives proper fonts):
sudo apt install python3-tk
Miniforge's Python also ships tkinter if you have it:
~/miniforge3/bin/python ui.py
EOF
exit 1
fi
exec "$PY" ui.py "$@"