INNER CODE UNIT · Python
_stream_process_key
yihong1120/Construction-Hazard-Detection · main.py:388
def _stream_process_key(cfg: StreamConfig) -> str:
"""Return the durable process key for a configured camera.
The fallback is only for programmatic callers predating ``stream_id``;
records loaded from PostgreSQL always use the immutable primary key.
"""
stream_id = cfg.get('stream_id')
if stream_id is not None:
return f"id:{stream_id}"
return str(cfg['video_url'])
@staticmethod
def _stream_log_label(cfg: StreamConfig) -> str:
"""Return a useful, non-secret stream label for lifecycle logs."""
return (
f"{cfg['site']}/{cfg['stream_name']}"
f" ({MainApp._stream_process_key(cfg)})"
)