- Updated `mapping.md` to reflect completed migration and testing status for event sweep and arena tasks. - Improved `arena.py` to ensure a return to home screen before opening tactical challenges, preventing navigation errors. - Enhanced `event_sweep.py` with robust handling for badge carousel navigation, including direct pagination dot clicks and extended wait times for cold-start scenarios. - Implemented Japanese OCR support for finished event detection in `event_sweep.py`, adding a definitive check to avoid false positives on stale event pages. - Adjusted retry logic and timeouts in `event_sweep.py` to accommodate longer loading times and ensure accurate stage row detection. - Updated `setup.sh` to check for the presence of the Japanese OCR language pack, providing installation instructions if missing. - Documented live testing results and fixes in `plan.md`, confirming successful sweeps and addressing previously reported bugs.
90 lines
3.7 KiB
Bash
Executable File
90 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Bootstrap a fresh clone of this repo so ba_dailies.sh can actually run.
|
|
#
|
|
# Run this ON nik-gpu, from the repo root (e.g. after `git clone` there) --
|
|
# not from macOS, since it installs into nik-gpu-local paths.
|
|
#
|
|
# It does NOT touch the game or take any screenshots; it only installs the
|
|
# venv and copies files to the fixed paths ba_dailies.sh/ba_daily.py/ba_auto
|
|
# expect (outside the repo, per the two-machine deploy convention in
|
|
# CLAUDE.md).
|
|
set -e
|
|
|
|
VENV_DIR="$HOME/.venvs/ba-auto-daily"
|
|
ASSETS_DIR="$HOME/ba_assets"
|
|
|
|
echo "== Checking host tools =="
|
|
missing=0
|
|
for cmd in xdotool scrot; do
|
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
echo "MISSING: $cmd (install with your package manager, e.g. sudo apt install $cmd)"
|
|
missing=1
|
|
fi
|
|
done
|
|
if [ "$missing" = 1 ]; then
|
|
echo "Install the missing tool(s) above, then re-run this script."
|
|
exit 1
|
|
fi
|
|
echo "xdotool, scrot: OK"
|
|
|
|
if ! command -v tesseract >/dev/null 2>&1; then
|
|
echo "MISSING: tesseract (OCR engine binary -- e.g. sudo apt install tesseract-ocr)"
|
|
echo "story_sweep's region/stage-label OCR (see CLAUDE.md \"OCR policy\") needs this."
|
|
echo "This requires a password-interactive sudo, so it isn't installed for you here --"
|
|
echo "install it yourself, then re-run this script."
|
|
missing=1
|
|
fi
|
|
if [ "$missing" = 1 ]; then
|
|
exit 1
|
|
fi
|
|
echo "tesseract: OK"
|
|
|
|
if command -v tesseract >/dev/null 2>&1; then
|
|
if tesseract --list-langs 2>/dev/null | grep -qx jpn; then
|
|
echo "tesseract jpn (Japanese OCR) language pack: OK"
|
|
else
|
|
echo "MISSING: tesseract jpn language pack -- install with: sudo apt-get install -y tesseract-ocr-jpn"
|
|
echo "event_sweep.py's finished-event-page text detection (_is_finished_event_page,"
|
|
echo "see config.py's EVENT_FINISHED_TEXT_RECT comment) needs this -- every other"
|
|
echo "task's OCR only needs the base \"eng\" data already checked above, so this is"
|
|
echo "not a hard requirement for the rest of the project. This also requires"
|
|
echo "password-interactive sudo, so it isn't installed for you here -- install it"
|
|
echo "yourself if you plan to run event_sweep, then re-run this script."
|
|
fi
|
|
fi
|
|
|
|
echo "== Setting up Python venv at $VENV_DIR =="
|
|
if [ ! -x "$VENV_DIR/bin/python3" ]; then
|
|
python3 -m venv "$VENV_DIR"
|
|
fi
|
|
"$VENV_DIR/bin/pip" install --quiet --upgrade pip
|
|
"$VENV_DIR/bin/pip" install --quiet opencv-python-headless numpy pytesseract
|
|
"$VENV_DIR/bin/python3" -c "import cv2, numpy; print('opencv', cv2.__version__, '/ numpy', numpy.__version__)"
|
|
"$VENV_DIR/bin/python3" -c "import pytesseract; print('pytesseract', pytesseract.get_tesseract_version())"
|
|
|
|
echo "== Deploying assets to fixed paths =="
|
|
mkdir -p "$ASSETS_DIR"
|
|
cp assets/cafe_sparkle.png "$ASSETS_DIR/cafe_sparkle.png"
|
|
|
|
echo "== Deploying Python-first entry point =="
|
|
cp ba_dailies.sh "$HOME/ba_dailies.sh"
|
|
chmod +x "$HOME/ba_dailies.sh"
|
|
cp ba_daily.py "$HOME/ba_daily.py"
|
|
rm -rf "$HOME/ba_auto"
|
|
cp -r ba_auto "$HOME/ba_auto"
|
|
|
|
echo "== Installing tab completion =="
|
|
cp completions/ba_dailies.bash "$HOME/.ba_dailies_completion.bash"
|
|
COMPLETION_LINE='source "$HOME/.ba_dailies_completion.bash"'
|
|
if [ -f "$HOME/.bashrc" ] && ! grep -qF ".ba_dailies_completion.bash" "$HOME/.bashrc"; then
|
|
printf '\n# Added by ba-auto-daily setup.sh\n%s\n' "$COMPLETION_LINE" >> "$HOME/.bashrc"
|
|
echo "Added source line to ~/.bashrc"
|
|
else
|
|
echo "~/.bashrc already sources it (or doesn't exist) -- left untouched"
|
|
fi
|
|
echo "Run 'source ~/.bashrc' or open a new shell to pick up completion"
|
|
|
|
echo "== Done =="
|
|
echo "Run with: ~/ba_dailies.sh [mailbox|cafe|stamina|story_sweep|shop_common|shop_tactical|lesson]"
|
|
echo "(requires the game already running, window titled 'BlueArchive')"
|