-> add an autoupdate mechanism
+-> cache jpegs from remote cameras locally
+-> cache prevention query arg should be according to the refresh rate
+-> the camera is not available on page load, it is never shown afterwards - increase the timeout
+-> click to zoom on cameras
+-> make camera frames positions configurable
+-> remote cameras are presented as http:///dev/video0
+-> add a view log functionality
+-> add a previewer for movies
+-> add a previewer for snapshots
-> style scroll bars
-> hint text next to section titles
-> clickable hints
--> make camera frames positions configurable
--> add a view log functionality
--> click to zoom on cameras
--> add a previewer for movies
--> add a previewer for snapshots
--> add a motioneye.svg icon
-> implement working schedule (add another combo deciding what to do during working schedule)
-> add other options applicable only to special devices (rpi): wifi settings, notifications
import subprocess
+_resolutions_cache = {}
+_ctrls_cache = {}
+_ctrl_values_cache = {}
+
+
def list_devices():
+ global _resolutions_cache
+
logging.debug('listing v4l devices...')
devices = []
else:
name = line.split('(')[0].strip()
+
+ # clear the cache
+ _resolutions_cache = {}
+ _ctrls_cache = {}
+ _ctrl_values_cache = {}
return devices
def list_resolutions(device):
+ global _resolutions_cache
+
+ if device in _resolutions_cache:
+ return _resolutions_cache[device]
+
logging.debug('listing resolutions of device %(device)s...' % {'device': device})
resolutions = set()
logging.debug('found resolution %(width)sx%(height)s for device %(device)s' % {
'device': device, 'width': width, 'height': height})
- return list(sorted(resolutions, key=lambda r: (r[0], r[1])))
+ resolutions = list(sorted(resolutions, key=lambda r: (r[0], r[1])))
+ _resolutions_cache[device] = resolutions
+
+ return resolutions
def get_brightness(device):
def _get_ctrl(device, control):
+ global _ctrl_values_cache
+
+ if device in _ctrl_values_cache and control in _ctrl_values_cache[device]:
+ return _ctrl_values_cache[device][control]
+
controls = _list_ctrls(device)
properties = controls.get(control)
if properties is None:
def _set_ctrl(device, control, value):
+ global _ctrl_values_cache
+
controls = _list_ctrls(device)
properties = controls.get(control)
if properties is None:
return
+ _ctrl_values_cache.setdefault(device, {})[control] = value
+
# adjust the value range
if 'min' in properties and 'max' in properties:
min_value = int(properties['min'])
def _list_ctrls(device):
+ global _ctrls_cache
+
+ if device in _ctrls_cache:
+ return _ctrls_cache[device]
+
output = subprocess.check_output('v4l2-ctl -d %(device)s --list-ctrls' % {
'device': device}, shell=True)
properties = dict([v.split('=') for v in properties.split(' ')])
controls[control] = properties
+ _ctrls_cache[device] = controls
+
return controls