]> www.vanbest.org Git - motioneye-debian/commitdiff
handle error when local camera is used to fetch movie, add exception details to error log
authorPaul Annekov <paul.annekov@gmail.com>
Tue, 3 Apr 2018 17:48:50 +0000 (20:48 +0300)
committerPaul Annekov <paul.annekov@gmail.com>
Tue, 3 Apr 2018 17:48:50 +0000 (20:48 +0300)
motioneye/handlers.py

index 339d48b52871fa9d5bd00cb4dd87bc5b4736c434..3438f15265941265248713b01574a72af67c315b 100644 (file)
@@ -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):