From 39de61316128a7ac4dc0c12accb8585072e17cfa Mon Sep 17 00:00:00 2001 From: Gavin Date: Wed, 10 Jan 2018 08:19:38 -0800 Subject: [PATCH 1/3] When dialog is present we are most likely reviewing captured images/movies which can cause a load of thumbnails to be downloaded. If we are capturing and reviewing on a Raspberry Pi 2 or lower then continuing to refresh the camera can cause very slow loading of the thumbnails. Since the camera(s) are at least partially obscured when the dialog is up, then pausing them seems acceptable. --- motioneye/static/js/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index e11ff1668..1097a0655 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -4932,6 +4932,11 @@ function isFullScreen() { function refreshCameraFrames() { var timestamp = new Date().getTime(); + if ($('div.modal-container').is(':visible')) { + /* pause camera refresh if hidden by a dialog */ + return setTimeout(refreshCameraFrames, 1000); + } + function refreshCameraFrame(cameraId, img, serverSideResize) { if (refreshDisabled[cameraId]) { /* camera refreshing disabled, retry later */ From a765b701c80d65305cbcf794accaacd63b705cdf Mon Sep 17 00:00:00 2001 From: Gavin Date: Sun, 4 Feb 2018 06:40:51 -0800 Subject: [PATCH 2/3] Fix mime type for video downloads Make videos have mime type specific to the respective format instead of video/mpeg Addresses: - https://github.com/ccrisan/motioneye/issues/740 - https://github.com/ccrisan/motioneye/issues/775 --- motioneye/handlers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 motioneye/handlers.py diff --git a/motioneye/handlers.py b/motioneye/handlers.py old mode 100644 new mode 100755 index d69db8eae..4fe9125f4 --- a/motioneye/handlers.py +++ b/motioneye/handlers.py @@ -19,6 +19,7 @@ import hashlib import json import logging +import mimetypes import os import re import socket @@ -1521,7 +1522,7 @@ def download(self, camera_id, filename): content = mediafiles.get_media_content(camera_config, filename, 'movie') pretty_filename = camera_config['@name'] + '_' + os.path.basename(filename) - self.set_header('Content-Type', 'video/mpeg') + self.set_header('Content-Type', mimetypes.guess_type(filename)[0] or 'video/mpeg') self.set_header('Content-Disposition', 'attachment; filename=' + pretty_filename + ';') self.finish(content) @@ -1533,7 +1534,7 @@ def on_response(response=None, error=None): 'url': remote.pretty_camera_url(camera_config), 'msg': error}}) pretty_filename = os.path.basename(filename) # no camera name available w/o additional request - self.set_header('Content-Type', 'video/mpeg') + self.set_header('Content-Type', mimetypes.guess_type(filename)[0] or 'video/mpeg') self.set_header('Content-Disposition', 'attachment; filename=' + pretty_filename + ';') self.finish(response) From 293bde5cda2e544d7f32cc408f38d56b53c217c8 Mon Sep 17 00:00:00 2001 From: Mrnt Date: Sun, 4 Feb 2018 07:19:02 -0800 Subject: [PATCH 3/3] Fix change to file permissions --- motioneye/handlers.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 motioneye/handlers.py diff --git a/motioneye/handlers.py b/motioneye/handlers.py old mode 100755 new mode 100644