summaryrefslogtreecommitdiff
path: root/src/sound_bot.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-19 00:21:32 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-19 00:21:32 +0300
commit70a4e03c962d4fdd321e8756e7cc9f805932b708 (patch)
tree536c68c2cf913a2d4a9cc6abeb480d350b0d99a9 /src/sound_bot.py
parent009f1f22f1ff64228460a91e74d49eb409253fec (diff)
esp32-cam: support applying camera config
Diffstat (limited to 'src/sound_bot.py')
-rwxr-xr-xsrc/sound_bot.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sound_bot.py b/src/sound_bot.py
index 4cc08a3..ff522cd 100755
--- a/src/sound_bot.py
+++ b/src/sound_bot.py
@@ -54,6 +54,13 @@ def camera_exists(name: str) -> bool:
return name in config['cameras']
+def camera_settings(name: str) -> Optional[dict]:
+ try:
+ return config['cameras'][name]['settings']
+ except KeyError:
+ return None
+
+
def have_cameras() -> bool:
return 'cameras' in config and config['cameras']
@@ -427,6 +434,10 @@ def camera_capture(ctx: Context) -> None:
ctx.answer()
client = camera_client(cam)
+ if client.syncsettings(camera_settings(cam)) is True:
+ logger.debug('some settings were changed, sleeping for 0.4 sec')
+ time.sleep(0.4)
+
client.setflash(True if flash else False)
time.sleep(0.2)