projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ugh. Fix a bug in the new refactor of the env var config stuff.
[python_utils.git]
/
smart_home
/
cameras.py
diff --git
a/smart_home/cameras.py
b/smart_home/cameras.py
index f77ddc6a7ff22bac1fe1a63a6d09fb40e2dbc129..e8f164b3c0a6f1529347c79400b1036623a87d58 100644
(file)
--- a/
smart_home/cameras.py
+++ b/
smart_home/cameras.py
@@
-1,9
+1,13
@@
#!/usr/bin/env python3
#!/usr/bin/env python3
+# © Copyright 2021-2022, Scott Gasch
+
"""Utilities for dealing with the webcams."""
import logging
"""Utilities for dealing with the webcams."""
import logging
+from typing import Optional
+import scott_secrets
import smart_home.device as dev
logger = logging.getLogger(__name__)
import smart_home.device as dev
logger = logging.getLogger(__name__)
@@
-26,12
+30,13
@@
class BaseCamera(dev.Device):
super().__init__(name.strip(), mac.strip(), keywords)
self.camera_name = BaseCamera.camera_mapping.get(name, None)
super().__init__(name.strip(), mac.strip(), keywords)
self.camera_name = BaseCamera.camera_mapping.get(name, None)
- def get_stream_url(self) -> str:
+ def get_stream_url(self) -> Optional[str]:
+ """Get the URL for the webcam's live stream. Return None on error."""
+
name = self.camera_name
name = self.camera_name
- assert name is not None
+ if not name:
+ return None
if name == 'driveway':
if name == 'driveway':
- return
'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mjpeg/GKlT2FfiSQ
/driveway'
+ return
f'http://10.0.0.226:8080/{scott_secrets.SHINOBI_KEY1}/mjpeg/{scott_secrets.SHINOBI_KEY2}
/driveway'
else:
else:
- return (
- f'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mp4/GKlT2FfiSQ/{name}/s.mp4'
- )
+ return f'http://10.0.0.226:8080/{scott_secrets.SHINOBI_KEY1}/mp4/{scott_secrets.SHINOBI_KEY2}/{name}/s.mp4'