From: Calin Crisan Date: Sat, 12 Oct 2013 17:02:12 +0000 (+0300) Subject: got rid of connection closed, request closed & co. errors X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=29df119f8ff305c405e06f23a02d4d80af71f29c;p=motioneye-debian got rid of connection closed, request closed & co. errors --- diff --git a/doc/todo.txt b/doc/todo.txt index e5c0277..ccb284c 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,6 +1,4 @@ --> prevent Request closed errors by stopping mjpg clients before stopping motion - -> style scroll bars -> hint text next to section titles -> clickable hints diff --git a/src/config.py b/src/config.py index 8805164..d1db8e2 100644 --- a/src/config.py +++ b/src/config.py @@ -233,8 +233,7 @@ def set_camera(camera_id, data): main_config['thread'] = threads - if '@id' in data: - del data['@id'] + data['@id'] = camera_id set_main(main_config) diff --git a/src/handlers.py b/src/handlers.py index 9c757f2..04c959f 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -232,7 +232,10 @@ class ConfigHandler(BaseHandler): ui_config) except Exception as e: - return self.finish_json({'error': unicode(e)}) + logging.error('failed to set remote camera config: %(msg)s' % {'msg': unicode(e)}) + + if not no_finish: + return self.finish_json({'error': unicode(e)}) else: logging.debug('setting main config') @@ -242,7 +245,8 @@ class ConfigHandler(BaseHandler): motionctl.restart() - self.finish_json() + if not no_finish: + self.finish_json() @BaseHandler.auth(admin=True) def set_preview(self, camera_id): @@ -753,7 +757,7 @@ class ConfigHandler(BaseHandler): class SnapshotHandler(BaseHandler): - @asynchronous + #@asynchronous TODO don't forget about me def get(self, camera_id, op, filename=None): if camera_id is not None: camera_id = int(camera_id) diff --git a/src/mjpgclient.py b/src/mjpgclient.py index b0ac554..e8af7a3 100644 --- a/src/mjpgclient.py +++ b/src/mjpgclient.py @@ -113,8 +113,6 @@ def get_jpg(camera_id): client = MjpgClient(camera_id, port) client.connect() - return None - return MjpgClient.last_jpgs.get(camera_id) diff --git a/static/js/main.js b/static/js/main.js index 8d61223..4de18ce 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1261,6 +1261,14 @@ function doCloseCamera(cameraId) { } function refreshCameraFrames() { + if (isProgress()) { + /* no camera refreshing while in progress */ + + setTimeout(refreshCameraFrames, 1000); + + return; + } + function refreshCameraFrame(cameraId, img) { img.src = '/snapshot/' + cameraId + '/current/?_=' + new Date().getTime(); }