mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 14:16:31 +00:00
raspberrypi(2): minor fast network camera fix
This commit is contained in:
parent
9392e3fd57
commit
dfc9795761
@ -421,28 +421,29 @@ def _set_streameye_settings(camera_id, s):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
|
|
||||||
# a workaround to update the camera username and password
|
if 1 in config.get_camera_ids():
|
||||||
# since we cannot call set_camera() from here
|
# a workaround to update the camera username and password
|
||||||
if s['seAuthMode'] == 'basic':
|
# since we cannot call set_camera() from here
|
||||||
url = 'http://%s:%s@127.0.0.1:%s/' % (username, password, s['sePort'])
|
if s['seAuthMode'] == 'basic':
|
||||||
|
url = 'http://%s:%s@127.0.0.1:%s/' % (username, password, s['sePort'])
|
||||||
else:
|
|
||||||
url = 'http://127.0.0.1:%s/' % s['sePort']
|
else:
|
||||||
|
url = 'http://127.0.0.1:%s/' % s['sePort']
|
||||||
if 1 in config._camera_config_cache:
|
|
||||||
logging.debug('updating streaming authentication in config cache')
|
if 1 in config._camera_config_cache:
|
||||||
config._camera_config_cache[1]['@url'] = url
|
logging.debug('updating streaming authentication in config cache')
|
||||||
|
config._camera_config_cache[1]['@url'] = url
|
||||||
|
|
||||||
lines = config.get_camera(1, as_lines=True)
|
lines = config.get_camera(1, as_lines=True)
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if line.startswith('# @url'):
|
if line.startswith('# @url'):
|
||||||
lines[i] = '# @url %s' % url
|
lines[i] = '# @url %s' % url
|
||||||
|
|
||||||
config_file = os.path.join(settings.CONF_PATH, config._CAMERA_CONFIG_FILE_NAME % {'id': 1})
|
config_file = os.path.join(settings.CONF_PATH, config._CAMERA_CONFIG_FILE_NAME % {'id': 1})
|
||||||
logging.debug('updating streaming authentication in camera config file %s' % config_file)
|
logging.debug('updating streaming authentication in camera config file %s' % config_file)
|
||||||
with open(config_file, 'w') as f:
|
with open(config_file, 'w') as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
|
|
||||||
logging.debug('restarting streameye')
|
logging.debug('restarting streameye')
|
||||||
if os.system('streameye.sh restart'):
|
if os.system('streameye.sh restart'):
|
||||||
|
@ -421,28 +421,29 @@ def _set_streameye_settings(camera_id, s):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
|
|
||||||
# a workaround to update the camera username and password
|
if 1 in config.get_camera_ids():
|
||||||
# since we cannot call set_camera() from here
|
# a workaround to update the camera username and password
|
||||||
if s['seAuthMode'] == 'basic':
|
# since we cannot call set_camera() from here
|
||||||
url = 'http://%s:%s@127.0.0.1:%s/' % (username, password, s['sePort'])
|
if s['seAuthMode'] == 'basic':
|
||||||
|
url = 'http://%s:%s@127.0.0.1:%s/' % (username, password, s['sePort'])
|
||||||
else:
|
|
||||||
url = 'http://127.0.0.1:%s/' % s['sePort']
|
else:
|
||||||
|
url = 'http://127.0.0.1:%s/' % s['sePort']
|
||||||
if 1 in config._camera_config_cache:
|
|
||||||
logging.debug('updating streaming authentication in config cache')
|
if 1 in config._camera_config_cache:
|
||||||
config._camera_config_cache[1]['@url'] = url
|
logging.debug('updating streaming authentication in config cache')
|
||||||
|
config._camera_config_cache[1]['@url'] = url
|
||||||
|
|
||||||
lines = config.get_camera(1, as_lines=True)
|
lines = config.get_camera(1, as_lines=True)
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if line.startswith('# @url'):
|
if line.startswith('# @url'):
|
||||||
lines[i] = '# @url %s' % url
|
lines[i] = '# @url %s' % url
|
||||||
|
|
||||||
config_file = os.path.join(settings.CONF_PATH, config._CAMERA_CONFIG_FILE_NAME % {'id': 1})
|
config_file = os.path.join(settings.CONF_PATH, config._CAMERA_CONFIG_FILE_NAME % {'id': 1})
|
||||||
logging.debug('updating streaming authentication in camera config file %s' % config_file)
|
logging.debug('updating streaming authentication in camera config file %s' % config_file)
|
||||||
with open(config_file, 'w') as f:
|
with open(config_file, 'w') as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
|
|
||||||
logging.debug('restarting streameye')
|
logging.debug('restarting streameye')
|
||||||
if os.system('streameye.sh restart'):
|
if os.system('streameye.sh restart'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user