webstation-broker
DeveloperPython reference

screenshot

Save-state frame capture over the selkies screenshot API.

Save-state frame capture over the selkies screenshot API.

Selkies answers GET /api/screenshot with a PNG of the primary display, the cursor drawn in, taken by pixelflux from the live capture. The route is on the same server as the token endpoint, so it is reached through the same candidate bases (SELKIES_SCREENSHOT_URLS) with the same master token, and the base that last answered is tried first. The frame is scaled down here to the thumbnail RomM files beside a state.

attributelog
= logging.getLogger(__name__)
attributeSCREENSHOT_TIMEOUT
= 5.0

Seconds a screenshot request gets; on Wayland it forces a one-frame GPU readback.

func_screenshot_urls() -> list[str]

Return the candidate screenshot endpoints, last-known-good first.

Returns

list

The configured endpoints, with _active_url moved to the front when it

funccapture_frame() -> Optional[bytes]

Grab the streamed desktop as it is right now, scaled for a state thumbnail.

Never raises: the frame is taken on the way into a save, and a missing preview must not read as a failed save.

Returns

typing.Optional

PNG bytes bounded to STATE_SCREENSHOT_SIZE on the longest side, or

func_thumbnail(raw) -> Optional[bytes]

Scale a captured frame to the thumbnail size and re-encode it as PNG.

paramrawbytes

The full-size frame as the endpoint returned it.

Returns

typing.Optional

PNG bytes bounded to STATE_SCREENSHOT_SIZE on the longest side, or