Skip to main content

Module camera_url

Module camera_url 

Source
Expand description

RTSP URL construction from vendor templates, plus credential masking.

Functions§

anr_replay_url
Build the replay (playback) URL used by ANR to pull a [start, end] window from the camera’s ONBOARD storage. Honors a per-camera anr_replay_url_template (with {start} / {end} placeholders, filled with Hikvision-format timestamps); otherwise defaults to the Hikvision RTSP playback endpoint (/Streaming/tracks/{channel}?starttime=..&endtime=..) built from the camera’s address + credentials. Returns None when there is no template and no host/credentials to build one from. Best-effort and camera-dependent — see services/anr.rs.
mask_url
Replace user:pass@ (or user@) credentials in an RTSP/HTTP URL with *** for safe logging/display.
record_url
The RTSP URL for the stream this camera records.
stream_url
Build the RTSP URL (with credentials) for the given stream (“main” | “sub”). Honors an explicit per-stream URL override; otherwise builds from the vendor template.
validate_stream_url
Validate an operator-supplied stream URL: must parse and use an allowed scheme.