class Oracle(object): def __init__(self): # Connect to the Gazepoint tracker. self.gp = GazePoint() # Establish an event bus. self.events = Events() # Set up the watchdog... try: os.remove('request.oracle') except: pass target_files = ['request.oracle'] self.watchdog = Watchdog(target_files) self.watchdog.events.on_change += self.scan def scan(self, target_file): # Load oracle request. scan = Vessel(target_file).scan # Start the scan. scan = self.gp.collect(scan) os.remove('request.oracle') try: db.update(scan) except: print('Cannot save to database.') def kill(): self.watchdog.kill() self.gp.kill()
from gazepoint import GazePoint import sys sys.path.append('../../mathtools') from mathtools.utils import Vessel if __name__ == '__main__': scan = {'_id': '12342134'} gazepoint = GazePoint() data = gazepoint.collect(scan) gazepoint.kill()