X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=smart_home%2Fcameras.py;h=712d73f18f5b82db0de4fd9fdebaaafd3ec71182;hb=7ff2af6fe7bffea90dc4a31c93140c189917c659;hp=963f54ef089f6fdaf6d7fa3f041912ac229dc881;hpb=889f57512986d1b799582c58d712b304b706391c;p=python_utils.git diff --git a/smart_home/cameras.py b/smart_home/cameras.py index 963f54e..712d73f 100644 --- a/smart_home/cameras.py +++ b/smart_home/cameras.py @@ -2,32 +2,22 @@ """Utilities for dealing with the webcams.""" -from abc import abstractmethod -import datetime -import json import logging -import os -import re -import subprocess -import sys -from typing import Any, Dict, List, Optional, Set - -import argparse_utils -import config -import logging_utils + import smart_home.device as dev -from google_assistant import ask_google, GoogleResponse -from decorator_utils import timeout, memoized logger = logging.getLogger(__name__) + class BaseCamera(dev.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: @@ -35,5 +25,9 @@ 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'