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
622617def 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
667661def 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):
18361834def _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 )
0 commit comments