reprostim.capture.metadata¶
API to extract REPROSTIM-METADATA-JSON entries embedded in reprostim-videocapture log files.
See .ai/capture/metadata-spec.md for the full specification.
Functions
|
Find the first metadata entry for |
|
Find the first metadata JSON entry with a specific key-value pair. |
|
Iterate over all REPROSTIM-METADATA-JSON lines in the log file. |
Classes
|
Fields common to every REPROSTIM-METADATA-JSON entry, regardless of |
|
|
|
|
|
|
|
|
- class reprostim.capture.metadata.MetadataBase(*, type: str | None = None, version: str | None = None, json_ts: str | None = None, json_isotime: str | None = None, cap_ts_start: str | None = None, cap_isotime_start: str | None = None)[source]¶
Fields common to every REPROSTIM-METADATA-JSON entry, regardless of
MetadataType.All fields are
Optional[str]for now, mirroring the raw JSON as written by_METADATA_LOGinsrc/reprostim-capture/videocapture/src/VideoCapture.cpp— no semantic typing (e.g. parsed timestamps, numeric resolution) yet. Values that aren’t already JSON strings (cx/cyare JSON numbers,autoRecoveryis a JSON bool) are coerced tostron load.- cap_isotime_start: str | None¶
- cap_ts_start: str | None¶
- json_isotime: str | None¶
- json_ts: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- type: str | None¶
- version: str | None¶
- class reprostim.capture.metadata.MetadataCaptureStop(*, type: str | None = None, version: str | None = None, json_ts: str | None = None, json_isotime: str | None = None, cap_ts_start: str | None = None, cap_isotime_start: str | None = None, message: str | None = None, cap_ts_stop: str | None = None, cap_isotime_stop: str | None = None)[source]¶
type: capture_stop— written when capture stops.- cap_isotime_stop: str | None¶
- cap_ts_stop: str | None¶
- message: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class reprostim.capture.metadata.MetadataSessionBegin(*, type: str | None = None, version: str | None = None, json_ts: str | None = None, json_isotime: str | None = None, cap_ts_start: str | None = None, cap_isotime_start: str | None = None, appName: str | None = None, serial: str | None = None, vDev: str | None = None, aDev: str | None = None, cx: str | None = None, cy: str | None = None, frameRate: str | None = None, autoRecovery: str | None = None)[source]¶
type: session_begin— written once when a recording session starts.- aDev: str | None¶
- appName: str | None¶
- autoRecovery: str | None¶
- cx: str | None¶
- cy: str | None¶
- frameRate: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- serial: str | None¶
- vDev: str | None¶
- class reprostim.capture.metadata.MetadataSessionEnd(*, type: str | None = None, version: str | None = None, json_ts: str | None = None, json_isotime: str | None = None, cap_ts_start: str | None = None, cap_isotime_start: str | None = None, message: str | None = None)[source]¶
type: session_end— written once the session logger closes, after the ffmpeg thread has terminated.- message: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class reprostim.capture.metadata.MetadataType(value)[source]¶
typefield values emitted via_METADATA_LOGinsrc/reprostim-capture/videocapture/src/VideoCapture.cpp. Keep in sync with that file — these are the only three values reprostim-videocapture currently writes.- CAPTURE_STOP = 'capture_stop'¶
Emitted when capture stops (
messageexplains why); carriescap_ts_start/cap_isotime_startandcap_ts_stop/cap_isotime_stop.
- SESSION_BEGIN = 'session_begin'¶
Emitted once when a recording session starts; carries device/session info (
serial,vDev,aDev,cx,cy,frameRate,autoRecovery,cap_ts_start/cap_isotime_start).
- SESSION_END = 'session_end'¶
Emitted once when the session logger closes, after the ffmpeg thread has terminated; carries
messageandcap_ts_start/cap_isotime_start.
- reprostim.capture.metadata.find_metadata_by_class(path: str, cls: Type[T]) T | None[source]¶
Find the first metadata entry for
cls’sMetadataTypeand parse it ascls.Looks up
cls’s correspondingMetadataType(via_find_metadata_type_by_class()) and callsfind_metadata_json(path, "type", metadata_type.value).- Parameters:
path (str) – Path to the log file
cls (Type[T]) –
MetadataBasesubclass to search for and parse the result into, e.g.MetadataSessionBegin
- Returns:
An instance of
clsfor the first matching entry, orNoneifclshas no correspondingMetadataType(logged as an error) or no matching metadata entry exists in the log- Return type:
Optional[T]
- reprostim.capture.metadata.find_metadata_json(path: str, key: str, value) Dict | None[source]¶
Find the first metadata JSON entry with a specific key-value pair.
- Parameters:
path (str) – Path to the log file
key (str) – Key to search for
value (Any) – Value to match
- Returns:
The first matching dictionary or None if not found
- Return type:
Optional[Dict]
- reprostim.capture.metadata.iter_metadata_json(log_path: str) Generator[Dict, None, None][source]¶
Iterate over all REPROSTIM-METADATA-JSON lines in the log file. Yields parsed JSON dictionaries.
- Parameters:
log_path (str) – Path to the log file
- Returns:
Generator of parsed JSON dictionaries
- Return type:
Generator[Dict, None, None]