Skip to content

Commit d64a0d3

Browse files
committed
Merge branch 'dev'
2 parents d29d81e + 6dafab2 commit d64a0d3

File tree

13 files changed

+541
-349
lines changed

13 files changed

+541
-349
lines changed

extra/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ ADD extra/motioneye.conf.sample /usr/share/motioneye/extra/
5959

6060
CMD test -e /etc/motioneye/motioneye.conf || \
6161
cp /usr/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf ; \
62-
/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf -d
62+
/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
6363

6464
EXPOSE 8765

extra/Dockerfile.armv7-armhf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN apt-get update && \
4040
git clone --depth 1 https://github.com/Hexxeh/rpi-firmware.git /tmp/rpi-firmware && \
4141
cp -rv /tmp/rpi-firmware/vc/hardfp/opt/vc /opt && \
4242
rm -rf /tmp/rpi-firmware && \
43+
ln -sf /opt/vc/bin/vcgencmd /usr/bin/vcgencmd && \
4344
curl -L --output /tmp/motion.deb https://github.com/Motion-Project/motion/releases/download/release-4.2.2/pi_stretch_motion_4.2.2-1_armhf.deb && \
4445
dpkg -i /tmp/motion.deb && \
4546
rm /tmp/motion.deb && \
@@ -66,6 +67,6 @@ ADD extra/motioneye.conf.sample /usr/share/motioneye/extra/
6667

6768
CMD test -e /etc/motioneye/motioneye.conf || \
6869
cp /usr/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf ; \
69-
/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf -d
70+
/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
7071

7172
EXPOSE 8765

extra/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: "2"
33
services:
44
motioneye:
5-
image: cahna/motioneye
5+
image: ccrisan/motioneye:master-amd64 # Change to ccrisan/motioneye:master-armhf for ARM chips (Pi etc.)
66
ports:
77
- "8081:8081"
88
- "8765:8765"

motioneye/config.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
'text_left',
106106
'text_right',
107107
'threshold',
108+
'threshold_maximum',
109+
'threshold_tune',
108110
'videodevice',
109111
'vid_control_params',
110112
'webcontrol_interface',
@@ -500,13 +502,6 @@ def add_camera(device_details):
500502
if device_details['port']:
501503
host += ':' + str(device_details['port'])
502504

503-
if device_details['username'] and proto == 'mjpeg':
504-
if device_details['password']:
505-
host = device_details['username'] + ':' + device_details['password'] + '@' + host
506-
507-
else:
508-
host = device_details['username'] + '@' + host
509-
510505
device_details['url'] = urlparse.urlunparse(
511506
(device_details['scheme'], host, device_details['path'], '', '', ''))
512507

@@ -621,7 +616,6 @@ def rem_camera(camera_id):
621616

622617
def main_ui_to_dict(ui):
623618
data = {
624-
'@show_advanced': ui['show_advanced'],
625619
'@admin_username': ui['admin_username'],
626620
'@normal_username': ui['normal_username']
627621
}
@@ -666,7 +660,6 @@ def call_hook(u, p):
666660

667661
def main_dict_to_ui(data):
668662
ui = {
669-
'show_advanced': data['@show_advanced'],
670663
'admin_username': data['@admin_username'],
671664
'normal_username': data['@normal_username']
672665
}
@@ -766,6 +759,8 @@ def motion_camera_ui_to_dict(ui, prev_config=None):
766759
'emulate_motion': False,
767760
'text_changes': ui['show_frame_changes'],
768761
'locate_motion_mode': ui['show_frame_changes'],
762+
'threshold_maximum': ui['max_frame_change_threshold'],
763+
'threshold_tune': ui['auto_threshold_tuning'],
769764
'noise_tune': ui['auto_noise_detect'],
770765
'noise_level': max(1, int(round(int(ui['noise_level']) * 2.55))),
771766
'lightswitch_percent': ui['light_switch_detect'],
@@ -830,6 +825,7 @@ def motion_camera_ui_to_dict(ui, prev_config=None):
830825
threshold = int(float(ui['frame_change_threshold']) * 640 * 480 / 100)
831826

832827
data['threshold'] = threshold
828+
833829

834830
if (ui['storage_device'] == 'network-share') and settings.SMB_SHARES:
835831
mount_point = smbctl.make_mount_point(ui['network_server'], ui['network_share_name'], ui['network_username'])
@@ -1133,6 +1129,8 @@ def motion_camera_dict_to_ui(data):
11331129
'motion_detection': data['@motion_detection'],
11341130
'show_frame_changes': data['text_changes'] or data['locate_motion_mode'],
11351131
'auto_noise_detect': data['noise_tune'],
1132+
'max_frame_change_threshold': data['threshold_maximum'],
1133+
'auto_threshold_tuning': data['threshold_tune'],
11361134
'noise_level': int(int(data['noise_level']) / 2.55),
11371135
'light_switch_detect': data['lightswitch_percent'],
11381136
'despeckle_filter': data['despeckle_filter'],
@@ -1381,7 +1379,7 @@ def motion_camera_dict_to_ui(data):
13811379
command_notifications = []
13821380
for e in on_event_start:
13831381
if e.count(' sendmail '):
1384-
e = shlex.split(e)
1382+
e = shlex.split(utils.make_str(e)) # poor shlex can't deal with unicode properly
13851383

13861384
if len(e) < 10:
13871385
continue
@@ -1405,7 +1403,7 @@ def motion_camera_dict_to_ui(data):
14051403
ui['email_notifications_picture_time_span'] = 0
14061404

14071405
elif e.count(' webhook '):
1408-
e = shlex.split(e)
1406+
e = shlex.split(utils.make_str(e)) # poor shlex can't deal with unicode properly
14091407

14101408
if len(e) < 3:
14111409
continue
@@ -1449,7 +1447,7 @@ def motion_camera_dict_to_ui(data):
14491447
command_storage = []
14501448
for e in on_movie_end:
14511449
if e.count(' webhook '):
1452-
e = shlex.split(e)
1450+
e = shlex.split(utils.make_str(e)) # poor shlex can't deal with unicode properly
14531451

14541452
if len(e) < 3:
14551453
continue
@@ -1836,7 +1834,6 @@ def _dict_to_conf(lines, data, list_names=None):
18361834
def _set_default_motion(data):
18371835
data.setdefault('@enabled', True)
18381836

1839-
data.setdefault('@show_advanced', False)
18401837
data.setdefault('@admin_username', 'admin')
18411838
data.setdefault('@admin_password', '')
18421839
data.setdefault('@normal_username', 'user')
@@ -1903,6 +1900,8 @@ def _set_default_motion_camera(camera_id, data):
19031900
data.setdefault('locate_motion_style', 'redbox')
19041901

19051902
data.setdefault('threshold', 2000)
1903+
data.setdefault('threshold_maximum', 0)
1904+
data.setdefault('threshold_tune', False)
19061905
data.setdefault('noise_tune', True)
19071906
data.setdefault('noise_level', 32)
19081907
data.setdefault('lightswitch_percent', 0)

motioneye/handlers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,9 @@ def authorize(self, camera_id):
901901

902902

903903
class PictureHandler(BaseHandler):
904+
def compute_etag(self):
905+
return None
906+
904907
@asynchronous
905908
def get(self, camera_id, op, filename=None, group=None):
906909
if camera_id is not None:
@@ -954,6 +957,9 @@ def post(self, camera_id, op, filename=None, group=None):
954957
@BaseHandler.auth(prompt=False)
955958
def current(self, camera_id, retry=0):
956959
self.set_header('Content-Type', 'image/jpeg')
960+
self.set_header('Cache-Control', 'no-store, must-revalidate')
961+
self.set_header('Pragma', 'no-cache')
962+
self.set_header('Expires', '0')
957963

958964
width = self.get_argument('width', None)
959965
height = self.get_argument('height', None)
@@ -1783,6 +1789,7 @@ def upload_media_file(self, filename, camera_id, camera_config):
17831789

17841790
tasks.add(5, uploadservices.upload_media_file, tag='upload_media_file(%s)' % filename,
17851791
camera_id=camera_id, service_name=service_name,
1792+
camera_name=camera_config['camera_name'],
17861793
target_dir=camera_config['@upload_subfolders'] and camera_config['target_dir'],
17871794
filename=filename)
17881795

motioneye/scripts/relayevent.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
if [ -z "$3" ]; then
44
echo "Usage: $0 <motioneye.conf> <event> <motion_camera_id> [filename]"

motioneye/static/js/frame.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function setupCameraFrame() {
2929
/* error and load handlers */
3030
cameraImg.error(function () {
3131
this.error = true;
32-
this.loading = 0;
32+
this.loading_count = 0;
3333

3434
cameraImg.addClass('error').removeClass('loading');
3535
cameraPlaceholder.css('opacity', 1);
@@ -42,7 +42,7 @@ function setupCameraFrame() {
4242
}
4343

4444
this.error = false;
45-
this.loading = 0;
45+
this.loading_count = 0;
4646

4747
cameraImg.removeClass('error').removeClass('loading');
4848
cameraPlaceholder.css('opacity', 0);
@@ -106,11 +106,11 @@ function refreshCameraFrame() {
106106
return;
107107
}
108108

109-
if (img.loading) {
110-
img.loading++; /* increases each time the camera would refresh but is still loading */
109+
if (img.loading_count) {
110+
img.loading_count++; /* increases each time the camera would refresh but is still loading */
111111

112-
if (img.loading > 2 * 1000 / refreshInterval) { /* limits the retry at one every two seconds */
113-
img.loading = 0;
112+
if (img.loading_count > 2 * 1000 / refreshInterval) { /* limits the retry at one every two seconds */
113+
img.loading_count = 0;
114114
}
115115
else {
116116
return; /* wait for the previous frame to finish loading */
@@ -125,7 +125,7 @@ function refreshCameraFrame() {
125125

126126
path = addAuthParams('GET', path);
127127
img.src = path;
128-
img.loading = 1;
128+
img.loading_count = 1;
129129

130130
cameraFrame.refreshDivider = 0;
131131
})();
@@ -141,4 +141,3 @@ $(document).ready(function () {
141141
setupCameraFrame();
142142
refreshCameraFrame();
143143
});
144-

0 commit comments

Comments
 (0)