diff options
-rwxr-xr-x | src/camera_node.py | 5 | ||||
-rw-r--r-- | src/home/media/__init__.py | 2 | ||||
-rw-r--r-- | src/home/media/__init__.pyi | 2 | ||||
-rw-r--r-- | src/home/media/storage.py | 13 |
4 files changed, 15 insertions, 7 deletions
diff --git a/src/camera_node.py b/src/camera_node.py index 59ecef0..2df8df7 100755 --- a/src/camera_node.py +++ b/src/camera_node.py @@ -3,7 +3,7 @@ import asyncio import time from home.config import config -from home.media import MediaNodeServer, CameraRecordStorage, CameraRecorder +from home.media import MediaNodeServer, ESP32CameraRecordStorage, CameraRecorder from home.camera import CameraType, esp32 from home.util import parse_addr, Addr from home import http @@ -66,12 +66,11 @@ class ESP32CameraNodeServer(MediaNodeServer): if __name__ == '__main__': config.load('camera_node') - storage = CameraRecordStorage(config['node']['storage']) - recorder_kwargs = {} camera_type = CameraType(config['camera']['type']) if camera_type == CameraType.ESP32: recorder_kwargs['stream_addr'] = parse_addr(config['camera']['web_addr']) # this is not a mistake, we don't use stream_addr for esp32-cam anymore + storage = ESP32CameraRecordStorage(config['node']['storage']) else: raise RuntimeError(f'unsupported camera type {camera_type}') 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 |