From 2474e946bf1f609a5ef50b54b761e1f80b6f99df Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Tue, 3 Apr 2018 20:48:50 +0300 Subject: [PATCH] handle error when local camera is used to fetch movie, add exception details to error log --- motioneye/handlers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/motioneye/handlers.py b/motioneye/handlers.py index 339d48b..3438f15 100644 --- a/motioneye/handlers.py +++ b/motioneye/handlers.py @@ -1606,6 +1606,8 @@ class MovieHandler(BaseHandler): class MoviePlaybackHandler(StaticFileHandler, BaseHandler): import tempfile tmpdir = tempfile.gettempdir() + '/MotionEye' + if not os.path.exists(tmpdir): + os.mkdir(tmpdir) @asynchronous @BaseHandler.auth() @@ -1652,8 +1654,6 @@ class MoviePlaybackHandler(StaticFileHandler, BaseHandler): os.utime(tmpfile, (time.time(), mtime)) return StaticFileHandler.get(self, tmpfile, include_body=include_body) - if not os.path.exists(self.tmpdir): - os.mkdir(self.tmpdir) remote.get_media_content(camera_config, filename, media_type='movie', callback=on_response) else: # assuming simple mjpeg camera @@ -1669,7 +1669,7 @@ class MoviePlaybackHandler(StaticFileHandler, BaseHandler): if os.path.isfile(f) and os.stat(f).st_atime <= stale_time: os.remove(f) except: - logging.error('could not delete temp file') + logging.exception('could not delete temp file') pass def get_absolute_path(self, root, path): -- 2.39.5