docs: README screenshots come from an invented demo library
release / web (push) Successful in 1m16s
release / go (push) Successful in 1m47s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m1s
release / android (push) Successful in 4m31s
release / Build signed APK (push) Successful in 4m52s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m16s
release / go (push) Successful in 1m47s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m1s
release / android (push) Successful in 4m31s
release / Build signed APK (push) Successful in 4m52s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped
Every artist, album, cover and song in the screenshots is generated by tools/demo-library, so none of it is anyone's real music or art. The folder builds the library (ffmpeg-synthesised audio, drawn covers), gives a demo account two months of listening so every Home mix appears, runs Minstrel and Postgres on a network with no internet, and retakes the screenshots with Playwright. The README now shows Home, Now playing and Home on a phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Capture the README screenshots from the demo stack.
|
||||
|
||||
Runs inside the Playwright image on the demo stack's network (see README.md):
|
||||
creates the demo account on the fresh instance, or signs in to it, and saves
|
||||
each page as a PNG under /shots.
|
||||
|
||||
capture_screenshots.py register SETUP_TOKEN # fresh instance: sign-up shot + account
|
||||
capture_screenshots.py pages # after seeding history and a restart
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
from playwright.sync_api import Page, sync_playwright
|
||||
|
||||
BASE = "http://minstrel:4533"
|
||||
USER, PASSWORD = "alex", "demo-password-123"
|
||||
STATE = "/shots/state.json"
|
||||
|
||||
|
||||
def settle(pg: Page, ms: int = 3000) -> None:
|
||||
# Home holds a live event stream open, so the page never goes network-idle.
|
||||
pg.wait_for_load_state("load")
|
||||
pg.wait_for_timeout(ms)
|
||||
|
||||
|
||||
def register(token: str) -> None:
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch()
|
||||
ctx = b.new_context(viewport={"width": 540, "height": 760}, device_scale_factor=2, color_scheme="dark")
|
||||
pg = ctx.new_page()
|
||||
pg.goto(f"{BASE}/register")
|
||||
settle(pg, 1500)
|
||||
pg.screenshot(path="/shots/register.png", full_page=True)
|
||||
pg.fill("input[autocomplete=username]", USER)
|
||||
pg.fill("input[autocomplete=name]", "Alex")
|
||||
pw = pg.locator("input[autocomplete=new-password]")
|
||||
pw.nth(0).fill(PASSWORD)
|
||||
pw.nth(1).fill(PASSWORD)
|
||||
pg.locator("input[autocomplete=off]").first.fill(token)
|
||||
pg.click("button[type=submit]")
|
||||
pg.wait_for_url(f"{BASE}/")
|
||||
ctx.storage_state(path=STATE)
|
||||
b.close()
|
||||
|
||||
|
||||
def pages() -> None:
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(args=["--autoplay-policy=no-user-gesture-required"])
|
||||
desk = b.new_context(viewport={"width": 1440, "height": 960}, device_scale_factor=1.25,
|
||||
color_scheme="dark", storage_state=STATE)
|
||||
pg = desk.new_page()
|
||||
pg.on("pageerror", lambda e: print("page error:", e, file=sys.stderr))
|
||||
|
||||
pg.goto(f"{BASE}/")
|
||||
settle(pg, 4000)
|
||||
pg.screenshot(path="/shots/home.png")
|
||||
|
||||
pg.goto(f"{BASE}/library/albums")
|
||||
settle(pg)
|
||||
pg.screenshot(path="/shots/library.png")
|
||||
|
||||
pg.get_by_text("Harbour Lights Out").first.click()
|
||||
settle(pg)
|
||||
pg.screenshot(path="/shots/album.png")
|
||||
|
||||
pg.get_by_role("button", name="Play").first.click()
|
||||
pg.wait_for_timeout(5000)
|
||||
# Open Now playing from inside the app, as a link would: a full page
|
||||
# load would start the player over, paused.
|
||||
pg.evaluate("p => { const a = document.createElement('a'); a.href = p;"
|
||||
" document.body.append(a); a.click(); a.remove(); }", "/now-playing")
|
||||
pg.wait_for_timeout(3000)
|
||||
pg.screenshot(path="/shots/now-playing.png")
|
||||
|
||||
pg.goto(f"{BASE}/settings")
|
||||
settle(pg)
|
||||
pg.get_by_text("Android app", exact=True).first.locator("xpath=ancestor::section[1]").screenshot(
|
||||
path="/shots/android-download.png")
|
||||
desk.close()
|
||||
|
||||
phone = b.new_context(viewport={"width": 390, "height": 844}, device_scale_factor=3,
|
||||
color_scheme="dark", storage_state=STATE)
|
||||
pg = phone.new_page()
|
||||
pg.goto(f"{BASE}/")
|
||||
settle(pg, 4000)
|
||||
pg.screenshot(path="/shots/home-phone.png")
|
||||
b.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) >= 3 and sys.argv[1] == "register":
|
||||
register(sys.argv[2])
|
||||
elif len(sys.argv) == 2 and sys.argv[1] == "pages":
|
||||
pages()
|
||||
else:
|
||||
print(__doc__, file=sys.stderr)
|
||||
sys.exit(2)
|
||||
Reference in New Issue
Block a user