X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=smart_home%2Fcameras.py;h=f77ddc6a7ff22bac1fe1a63a6d09fb40e2dbc129;hb=f2600f30801c849fc1d139386e3ddc3c9eb43e30;hp=40850a9fa1230013bde7782a1b23f26077b93dab;hpb=29ee1f98654a689e9cab76b0c7c68428faa43a8c;p=python_utils.git diff --git a/smart_home/cameras.py b/smart_home/cameras.py index 40850a9..f77ddc6 100644 --- a/smart_home/cameras.py +++ b/smart_home/cameras.py @@ -10,12 +10,16 @@ logger = logging.getLogger(__name__) class BaseCamera(dev.Device): + """A base class for a webcam device.""" + camera_mapping = { 'cabin_drivewaycam': 'cabin_driveway', 'outside_backyard_camera': 'backyard', - 'outside_driveway_camera': 'driveway', + 'outside_driveway_camera_wired': 'driveway', + 'outside_driveway_camera_wifi': 'driveway', 'outside_doorbell_camera': 'doorbell', - 'outside_front_door_camera': 'frontdoor', + 'outside_front_door_camera': 'front_door', + 'crawlspace_camera': 'crawlspace', } def __init__(self, name: str, mac: str, keywords: str = "") -> None: @@ -23,5 +27,11 @@ class BaseCamera(dev.Device): self.camera_name = BaseCamera.camera_mapping.get(name, None) def get_stream_url(self) -> str: - assert self.camera_name is not None - return f'http://10.0.0.56:81/mjpg/{self.camera_name}/video.mjpg?h=1024&q=99' + name = self.camera_name + assert name is not None + if name == 'driveway': + return 'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mjpeg/GKlT2FfiSQ/driveway' + else: + return ( + f'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mp4/GKlT2FfiSQ/{name}/s.mp4' + )