Add Google Photos picker, viewer, and slideshow with LVGL frontend - #136
Merged
Merged
Conversation
Google Photos on a PyDevices display. Since Google's March 2025 Library API cutoff, third-party apps can only show photos the user explicitly picks, so the example drives the Photos Picker API: the board shows a picker session as a QR code, the user picks on their phone, and the board lists the picks with thumbnails, views them full screen, and runs a slideshow. - lib/examples/google_photos/gphotos_engine.py: UI-agnostic Picker API client (refresh-token auth, sessions, paged listing, sized thumbnail downloads with a bounded flash cache, prefs) over urllib / MicroPython requests / adafruit_requests / raw socket + TLS. - gphotos_sim.py: simulator with sample photos for the gallery, PyScript, offline, or no-credentials runs (same shape as roku_sim). - gphotos_lvgl.py: LVGL front end with connect (QR), paged list, viewer, slideshow; network work drained from an lv.timer pump, no _thread. JPEG via TJPGD on CPython or displayif's jpegio LVGL decoder on MCU builds. - google_photos.py launcher mirrors roku_remote, and keeps -m launches alive (the host loop misreads package -m launches as a REPL). - tools/gphotos_auth.py: one-time PC-side Google sign-in (stdlib only, PKCE, loopback redirect) that writes the tokens file to copy to a board. - tests/test_gphotos_engine.py: 27 tests with faked HTTP for the engine, transports, simulator, and login tool. - README with Google Cloud setup, limits, and per-platform decoder notes; screenshots; MIP/TOML manifests, gallery card, and test-kit entries. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTpFxNSKF3xWnX6xhgPS7T
Bring the branch up to date with main (audiolive example, the audioif -> audiodsp rename, and the new gallery-payload staging test). Regenerated .site/gallery, .site/pyscript, packages/examples.json, and pydevices-examples.toml with the repo's own generators rather than relying on git's line merge, and confirmed both match --check exactly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTpFxNSKF3xWnX6xhgPS7T
CI's new test_every_module_a_card_imports_is_copied (from the main merge) caught a real gallery bug: google_photos.py's `# modules:` header put gphotos_engine/gphotos_sim/gphotos_lvgl into the card's bare `?modules=` query, but those files are staged under the google_photos/ package prefix via `manifests=google_photos`, not at the tree root -- a browser loading that card would 404 on them. `# modules:` is for a module-kind card's extra flat sibling files (e.g. calc_lvgl.py pulling in the top-level calc_engine.py); a manifest-kind package entry never needs it for its own package-internal siblings, matching the existing roku_remote.py precedent. Removing the line lets discover_package_py_files stage the package as-is and the card link becomes plain `?manifests=google_photos`. Regenerated the gallery pages and MIP manifests with the repo's generators; full unittest suite, ruff, and `gallery_generator.py --check` all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTpFxNSKF3xWnX6xhgPS7T
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a complete Google Photos integration for PyDevices displays, enabling users to pick photos from their phone and browse them on a microcontroller or desktop display.
Summary
Implements a Google Photos Picker API client with an LVGL-based frontend that supports photo selection via QR code pairing, thumbnail browsing, full-screen viewing, and automatic slideshows. Includes offline simulator mode for testing without credentials.
Key Changes
Core Engine (
gphotos_engine.py)LVGL Frontend (
gphotos_lvgl.py)Simulator (
gphotos_sim.py)GPHOTOS_SIM=1)Authentication Tool (
tools/gphotos_auth.py)Testing & Documentation
Implementation Details