import platform
import subprocess
from typing import NamedTuple, Optional
+import warnings
import cv2 # type: ignore
import numpy as np
return raw
except Exception as e:
logger.exception(e)
- logger.warning(f"Got a bad image or HTTP error from {url}")
+ msg = f"Got a bad image or HTTP error from {url}; returning None."
+ logger.warning(msg)
+ warnings.warn(msg)
return None
) -> Optional[bytes]:
"""Fetch the raw webcam image straight from the webcam's RTSP stream."""
hostname = blue_iris_camera_name_to_hostname(camera_name)
+ stream = f"rtsp://camera:IaLaIok@{hostname}:554/live"
try:
cmd = [
"/usr/bin/timeout",
"/usr/local/bin/ffmpeg",
"-y",
"-i",
- f"rtsp://camera:IaLaIok@{hostname}:554/live",
+ f"{stream}",
"-f",
"singlejpeg",
"-vframes",
return out
except Exception as e:
logger.exception(e)
- logger.warning("Failed to retrieve image from RTSP stream")
+ msg = "Failed to retrieve image via RTSP {stream}, returning None."
+ warnings.warn(msg)
+ logger.warning(msg)
return None
jpg=jpg,
hsv=hsv,
)
- logger.warning(
- "Failed to retieve image from both video server and direct RTSP stream"
- )
+ msg = "Failed to retieve image from both video server and direct RTSP stream"
+ logger.warning(msg)
+ warnings.warn(msg)
return RawJpgHsv(None, None, None)