StreamerResource¶
StreamerResource
¶
Streamer management — screenshots and OCR for PiKVM.
Source code in src/aiopikvm/resources/streamer.py
get_state()
async
¶
Get the current streamer state.
Returns:
| Type | Description |
|---|---|
StreamerState
|
Current streamer subsystem state. |
snapshot(*, allow_offline=False)
async
¶
Take a JPEG screenshot.
Without allow_offline, kvmd returns HTTP 503 whenever the
video source is not online (host asleep, HDMI unplugged, etc.).
Passing allow_offline=True makes kvmd return a "NO LIVE VIDEO"
placeholder JPEG instead. The flag has no effect when the streamer
process is fully stopped (no UI clients) — the call still fails
with HTTP 503.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allow_offline
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
bytes
|
Raw JPEG image bytes. |
Source code in src/aiopikvm/resources/streamer.py
get_ocr_info()
async
¶
Get OCR capability metadata (enabled flag, available languages).
Returns:
| Type | Description |
|---|---|
OCRInfo
|
Installed OCR languages and the default selection. |
Source code in src/aiopikvm/resources/streamer.py
ocr(*, langs=None, allow_offline=False, timeout=30.0)
async
¶
Perform OCR on the current screen.
Sends GET /api/streamer/snapshot?ocr=1 — the kvmd snapshot
endpoint with the ocr flag, which returns recognized text as
text/plain instead of a JPEG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
langs
|
list[str] | None
|
Tesseract language codes (e.g. |
None
|
allow_offline
|
bool
|
When |
False
|
timeout
|
float
|
Per-call timeout in seconds. OCR runs Tesseract on the Pi CPU and is intrinsically slow (10-20 s for full-screen), so the default is wider than the client-level default. |
30.0
|
Returns:
| Type | Description |
|---|---|
str
|
Recognized text. |