Skip to content

Commit

Permalink
Update motion config keys
Browse files Browse the repository at this point in the history
See: https://motion-project.github.io/motion_config.html

Signed-off-by: MichaIng <micha@dietpi.com>
  • Loading branch information
MichaIng committed Mar 9, 2022
1 parent ed73fbc commit ff45e8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions motioneye/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
'threshold',
'threshold_maximum',
'threshold_tune',
'videodevice',
'vid_control_params',
'video_device',
'video_params',
'webcontrol_interface',
'webcontrol_localhost',
'webcontrol_parms',
Expand Down Expand Up @@ -539,7 +539,7 @@ def add_camera(device_details):
camera_config['height'] = h
break

camera_config['videodevice'] = device_details['path']
camera_config['video_device'] = device_details['path']

elif proto == 'motioneye':
camera_config['@proto'] = 'motioneye'
Expand Down Expand Up @@ -808,7 +808,7 @@ def motion_camera_ui_to_dict(ui, prev_config=None):
proto = 'netcam'

if proto in ('v4l2', 'mmal'):
# leave videodevice unchanged
# leave video_device unchanged

# resolution
if not ui['resolution']:
Expand All @@ -823,8 +823,8 @@ def motion_camera_ui_to_dict(ui, prev_config=None):

if proto == 'v4l2':
# video controls
vid_control_params = (('%s=%s' % (n, c['value'])) for n, c in list(ui['video_controls'].items()))
data['vid_control_params'] = ','.join(vid_control_params)
video_params = (('%s=%s' % (n, c['value'])) for n, c in list(ui['video_controls'].items()))
data['video_params'] = ','.join(video_params)

else: # assuming netcam
if re.match(r'^rtsp|^rtmp', data.get('netcam_url', prev_config.get('netcam_url', ''))):
Expand Down Expand Up @@ -1228,21 +1228,21 @@ def motion_camera_dict_to_ui(data):
threshold = data['threshold'] * 100.0 / (data['width'] * data['height'])

else: # assuming v4l2
ui['device_url'] = data['videodevice']
ui['device_url'] = data['video_device']
ui['proto'] = 'v4l2'

# resolutions
resolutions = v4l2ctl.list_resolutions(data['videodevice'])
resolutions = v4l2ctl.list_resolutions(data['video_device'])
ui['available_resolutions'] = [(str(w) + 'x' + str(h)) for (w, h) in resolutions]
ui['resolution'] = str(data['width']) + 'x' + str(data['height'])

video_controls = v4l2ctl.list_ctrls(data['videodevice'])
video_controls = v4l2ctl.list_ctrls(data['video_device'])
video_controls = [(n, c) for (n, c) in list(video_controls.items())
if 'min' in c and 'max' in c and 'value' in c]

vid_control_params = data['vid_control_params'].split(',')
video_params = data['video_params'].split(',')
vid_control_values = {}
for param in vid_control_params:
for param in video_params:
parts = param.split('=')
if len(parts) == 1:
name, value = param, 1
Expand Down Expand Up @@ -1912,8 +1912,8 @@ def _set_default_motion_camera(camera_id, data):
data.setdefault('@id', camera_id)

if utils.is_v4l2_camera(data):
data.setdefault('videodevice', '/dev/video0')
data.setdefault('vid_control_params', '')
data.setdefault('video_device', '/dev/video0')
data.setdefault('video_params', '')
data.setdefault('width', 352)
data.setdefault('height', 288)

Expand Down
6 changes: 3 additions & 3 deletions motioneye/extra/motion.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ locate_motion_mode off
# Set the look and style of the locate box.
locate_motion_style box

# Text to be overlayed in the lower left corner of images
# Text to be overlaid in the lower left corner of images
text_left CAMERA1

# Text to be overlayed in the lower right corner of images.
# Text to be overlaid in the lower right corner of images.
text_right %d.%m.%Y\n%T

# Overlay number of changed pixels in upper right corner of images.
text_changes off

# Scale factor for text overlayed on images.
# Scale factor for text overlaid on images.
text_scale 1

# The special event conversion specifier %C
Expand Down

0 comments on commit ff45e8d

Please sign in to comment.