class CaptureControllerHTTPServer(BaseHTTPServer.HTTPServer): def __init__(self, server_address, request_handler_class): BaseHTTPServer.HTTPServer.__init__(self, server_address, request_handler_class) self.pcontroller = CaptureController() def get_filename(self): return os.path.join(CAPTURE_DIR, datetime.datetime.now().isoformat()) def start(self): if self.pcontroller.running(): return {'error': 'busy'} output_filename = self.get_filename() self.pcontroller.launch(output_filename) return self.status() def stop(self): if self.pcontroller.running(): self.pcontroller.terminate() return self.status() def status(self): if self.pcontroller.running(): return { 'status': 'running', 'output': self.pcontroller.output_filename } return { 'status': 'idle' }
class CaptureControllerHTTPServer(BaseHTTPServer.HTTPServer): def __init__(self, server_address, request_handler_class): BaseHTTPServer.HTTPServer.__init__(self, server_address, request_handler_class) self.pcontroller = CaptureController() def get_filename(self): return os.path.join(CAPTURE_DIR, datetime.datetime.now().isoformat()) def start(self): if self.pcontroller.running(): return {'error': 'busy'} output_filename = self.get_filename() self.pcontroller.launch(output_filename) return self.status() def stop(self): if self.pcontroller.running(): self.pcontroller.terminate() return self.status() def status(self): if self.pcontroller.running(): return { 'status': 'running', 'output': self.pcontroller.output_filename } return {'status': 'idle'}
def __init__(self, server_address, request_handler_class): BaseHTTPServer.HTTPServer.__init__(self, server_address, request_handler_class) self.pcontroller = CaptureController()
def __init__(self, server_address, request_handler_class): BaseHTTPServer.HTTPServer.__init__(self, server_address, request_handler_class) self.pcontroller = CaptureController()