#NEWLINE# def __init__( self , config = None , frames = 255 , resolution = '1600x1200' , brightness = '50%' , gain = '50%' ) : #NEWLINE# #INDENT# self . logger = get_logger ( self ) #NEWLINE# self . config = load_config ( ) #NEWLINE# assert ( self . config is not None ) , self . logger . warning ( 'Config not set for webcams' ) #NEWLINE# self . logger . info ( 'Creating webcams monitoring' ) #NEWLINE# self . webcams = self . config . get ( 'webcams' ) #NEWLINE# if ( self . webcams is None ) : #NEWLINE# #INDENT# err_msg = 'No webcams to connect. Please check config.yaml and all appropriate ports' #NEWLINE# self . logger . warning ( err_msg ) #NEWLINE# #UNINDENT# self . _is_capturing = False #NEWLINE# self . _processes = list ( ) #NEWLINE# for webcam in self . webcams : #NEWLINE# #INDENT# webcam_process = multiprocessing . Process ( target = self . loop_capture , args = [ err_msg ] ) #NEWLINE# webcam_process . daemon = True #NEWLINE# webcam_process . name = 'PANOPTES_{}' . format ( webcam . get ( 'name' ) ) . replace ( ' ' , '_' ) #NEWLINE# self . _processes . append ( webcam_process ) #NEWLINE# #UNINDENT# self . cmd = 'fswebcam' #NEWLINE# self . _timestamp = '%Y-%m-%d %H:%M:%S' #NEWLINE# self . _thumbnail_resolution = '240x120' #NEWLINE# self . base_params = '-F {} -r {} --set brightness={} --set gain={} --jpeg 100 --timestamp "{}" ' . format ( frames , resolution , brightness , gain , self . _timestamp )