Skip to content

Commit

Permalink
Revertion motion config keys
Browse files Browse the repository at this point in the history
and use a more generic motionEye scripts path, which matches the one of the current release, when installing as root. We should try to keep this valid and generally changes to install/setup steps low.

Signed-off-by: MichaIng <micha@dietpi.com>
  • Loading branch information
MichaIng committed Mar 11, 2022
1 parent fe8b36b commit 9594662
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 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',
'video_device',
'video_params',
'videodevice',
'vid_control_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['video_device'] = device_details['path']
camera_config['videodevice'] = 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 video_device unchanged
# leave videodevice 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
video_params = (('%s=%s' % (n, c['value'])) for n, c in list(ui['video_controls'].items()))
data['video_params'] = ','.join(video_params)
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)

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['video_device']
ui['device_url'] = data['videodevice']
ui['proto'] = 'v4l2'

# resolutions
resolutions = v4l2ctl.list_resolutions(data['video_device'])
resolutions = v4l2ctl.list_resolutions(data['videodevice'])
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['video_device'])
video_controls = v4l2ctl.list_ctrls(data['videodevice'])
video_controls = [(n, c) for (n, c) in list(video_controls.items())
if 'min' in c and 'max' in c and 'value' in c]

video_params = data['video_params'].split(',')
vid_control_params = data['vid_control_params'].split(',')
vid_control_values = {}
for param in video_params:
for param in vid_control_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('video_device', '/dev/video0')
data.setdefault('video_params', '')
data.setdefault('videodevice', '/dev/video0')
data.setdefault('vid_control_params', '')
data.setdefault('width', 352)
data.setdefault('height', 288)

Expand Down
8 changes: 4 additions & 4 deletions motioneye/extra/camera-1.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ movie_output off
movie_passthrough off
movie_codec mp4
movie_quality 75
on_event_start /home/dietpi/motioneye/motioneye/scripts/relayevent.sh "" start %t
on_event_end /home/dietpi/motioneye/motioneye/scripts/relayevent.sh "" stop %t
on_movie_end /home/dietpi/motioneye/motioneye/scripts/relayevent.sh "" movie_end %t %f
on_picture_save /home/dietpi/motioneye/motioneye/scripts/relayevent.sh "" picture_save %t %f
on_event_start /usr/local/share/motioneye/extra/scripts/relayevent.sh "" start %t
on_event_end /usr/local/share/motioneye/extra/scripts/relayevent.sh "" stop %t
on_movie_end /usr/local/share/motioneye/extra/scripts/relayevent.sh "" movie_end %t %f
on_picture_save /usr/local/share/motioneye/extra/scripts/relayevent.sh "" picture_save %t %f
stream_authentication user:user

0 comments on commit 9594662

Please sign in to comment.