Esempio n. 1
0
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' }
Esempio n. 2
0
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'}
Esempio n. 3
0
 def __init__(self, server_address, request_handler_class):
     BaseHTTPServer.HTTPServer.__init__(self, server_address,
                                        request_handler_class)
     self.pcontroller = CaptureController()
Esempio n. 4
0
 def __init__(self, server_address, request_handler_class):
     BaseHTTPServer.HTTPServer.__init__(self, server_address,
                                        request_handler_class)
     self.pcontroller = CaptureController()