def __init__(self): lib = cutil.find_library('v4lcapture') if lib is not None: self.v4l = cdll.LoadLibrary(lib) error.log('libv4lcapture.so shared library loaded') else: error.critical('cannot load libv4lcapture.so shared library')
def __init__(self): lib = cutil.find_library("v4lcapture") if lib is not None: self.v4l = cdll.LoadLibrary(lib) error.log("libv4lcapture.so shared library loaded") else: error.critical("cannot load libv4lcapture.so shared library")
def check_devices(): ''' Check if at least one /dev/video* device exists. ''' for file in os.listdir('/dev'): if file.startswith('video'): return error.critical('no /dev/video* devices found')
def check_eths(): ''' Check if at least one eth* interface exists. < error: Error object ''' for file in os.listdir('/sys/class/net/'): if file.startswith('eth') or file.startswith('eno') or\ file.startswith('ens') or file.startswith('enp') or \ file.startswith('enx'): return error.critical('no useful eth* interfaces found')
def _read(self): ''' Reads the json config file. If not found create a json object (dict). ''' if path.isfile(self.PATH): try: with open(self.PATH, 'r') as conf: self.conf = json.load(conf) error.log('{} loaded'.format(self.PATH)) except OSError: error.critical('cannot open {}'.format(self.PATH)) else: self.conf = {}