From e1d8a4eb86d3b4696d7679e5ded8ac036939c644 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Tue, 14 Jun 2022 23:49:20 +0300 Subject: camera_node: workaround for storage logic for esp32-cam based cam --- src/home/media/__init__.py | 2 +- src/home/media/__init__.pyi | 2 +- src/home/media/storage.py | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/home/media') diff --git a/src/home/media/__init__.py b/src/home/media/__init__.py index e8268cf..976c990 100644 --- a/src/home/media/__init__.py +++ b/src/home/media/__init__.py @@ -6,7 +6,7 @@ __map__ = { 'record_client': ['SoundRecordClient', 'CameraRecordClient', 'RecordClient'], 'node_server': ['MediaNodeServer'], 'node_client': ['SoundNodeClient', 'CameraNodeClient', 'MediaNodeClient'], - 'storage': ['SoundRecordStorage', 'CameraRecordStorage', 'SoundRecordFile', 'CameraRecordFile', 'RecordFile'], + 'storage': ['SoundRecordStorage', 'ESP32CameraRecordStorage', 'SoundRecordFile', 'CameraRecordFile', 'RecordFile'], 'record': ['SoundRecorder', 'CameraRecorder'] } diff --git a/src/home/media/__init__.pyi b/src/home/media/__init__.pyi index 0e85cde..77c2176 100644 --- a/src/home/media/__init__.pyi +++ b/src/home/media/__init__.pyi @@ -16,7 +16,7 @@ from .node_client import ( ) from .storage import ( SoundRecordStorage as SoundRecordStorage, - CameraRecordStorage as CameraRecordStorage, + ESP32CameraRecordStorage as ESP32CameraRecordStorage, SoundRecordFile as SoundRecordFile, CameraRecordFile as CameraRecordFile, RecordFile as RecordFile diff --git a/src/home/media/storage.py b/src/home/media/storage.py index 880b899..5c41981 100644 --- a/src/home/media/storage.py +++ b/src/home/media/storage.py @@ -116,6 +116,13 @@ class RecordFile: } +class PseudoRecordFile(RecordFile): + EXTENSION = 'null' + + def __init__(self): + super().__init__('/pseudo/file') + + class SoundRecordFile(RecordFile): EXTENSION = 'mp3' @@ -192,6 +199,8 @@ class SoundRecordStorage(RecordStorage): EXTENSION = 'mp3' -class CameraRecordStorage(RecordStorage): - EXTENSION = 'mp4' +class ESP32CameraRecordStorage(RecordStorage): + EXTENSION = 'jpg' # not used anyway + def save(self, *args, **kwargs): + return PseudoRecordFile() \ No newline at end of file -- cgit v1.2.3