예제 #1
0
 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')
예제 #2
0
 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")
예제 #3
0
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')
예제 #4
0
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')
예제 #5
0
 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 = {}