Skip to content

tools: add recover_batch.py — fleet-wide camera recovery sweep#7

Open
dropchop wants to merge 1 commit into
mainfrom
tools/recover-batch
Open

tools: add recover_batch.py — fleet-wide camera recovery sweep#7
dropchop wants to merge 1 commit into
mainfrom
tools/recover-batch

Conversation

@dropchop

Copy link
Copy Markdown
Owner

What

Adds tools/recover_batch.py, a batch/"secondary" version of recover_camera.py for sweeping a fleet of Larkfly cameras in one run instead of one camera at a time — the rig workflow where several cameras are powered up at once.

Flow: scan ActionCam_* APs → multi-select (1,3,4 / all, or skip the scan with repeated --ssid) → scan pass inventories every camera (connect → list → disconnect) → one keypress (y, or --yes) confirms the whole batch → download pass auto-cycles through each camera's AP, mirroring into its own ~/larkfly-recovered/<SSID>/.

How

Built entirely on recover_camera.py's proven primitives — same sudo nmcli bring-up (BSSID fallback → /32 camera route → DHCP IP detect+validate → FTP reachability), same ftp_pull.py read-only listing + download-only mirror, same bind=192.168.1.10 source-pinning. The parent's per-step methods gained an optional label= param so the batch flow can relabel step output; defaults keep recover_camera.py's own output identical.

Preserves all the safety properties: refuses to run as root, RETR-only (never DELE/STOR), dongle-restore-on-exit, Ctrl-C-safe. --scan-only stops after inventory; -n previews the exact commands. Exit code is the worst seen across the fleet.

Testing

  • tests/test_recover_batch.py — 10 unit tests covering parse_selection (ranges, dedup, out-of-range/garbage → re-prompt) and the reused derive_dest/map_pull_rc contract. Pure logic, no hardware/sudo.
  • Full suite green (36 tests). --help and -n dry-run smoke-checked.
  • Not yet run against a live fleet — first real run should use --scan-only to confirm per-AP connect+inventory before committing to the download pass.

🤖 Generated with Claude Code

Batch version of recover_camera.py: scan ActionCam_* APs, multi-select,
one scan pass to inventory every camera, then a single confirm to pull
the whole fleet (auto-cycling each AP into ~/larkfly-recovered/<SSID>/).

Reuses recover_camera.py's per-step methods via new label= params so the
batch flow can relabel the step output. --scan-only stops after inventory;
-n previews. Same root-refusal, dongle-restore-on-exit, and Ctrl-C safety.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant