Ejemplo n.º 1
0
    def __init__(self, **config):
        super().__init__(**config)

        port = self.get_setting('port')
        self.thread = nerve.Thread('TCPServerThread:' + str(port), self.run)
        self.thread.daemon = True
        self.thread.start()
Ejemplo n.º 2
0
    def __init__(self, **config):
        super().__init__(**config)

        self.xmms = None
        self.artist = ""
        self.title = ""
        self.reply = None

        self.thread = nerve.Thread('Xmms2Thread', self.run)
        self.thread.start()
Ejemplo n.º 3
0
    def __init__(self, **config):
        super().__init__(**config)

        self.username = self.get_setting("username")
        self.password = self.get_setting("password")
        self.port = self.get_setting('port')

        self.thread = nerve.Thread('TornadoWSGIServerThread:' + str(self.port),
                                   target=self.run)
        self.thread.daemon = True
        self.thread.start()
Ejemplo n.º 4
0
    def __init__(self, server, socket, addr):
        super().__init__()
        self.server = server
        self.socket = socket
        (self.hostname, self.port) = addr
        self.rfile = self.socket.makefile(mode='r',
                                          encoding='utf-8',
                                          newline='\n')

        self.thread = nerve.Thread(
            'TCPConnectionThread:' + self.hostname + ':' + str(self.port),
            self.run)
        self.thread.daemon = True
        self.thread.start()
Ejemplo n.º 5
0
    def __init__(self, url):
        super().__init__(url,
                         subprotocols=['application/json'],
                         on_open=self.on_open,
                         on_close=self.on_close,
                         on_message=self.on_message,
                         on_error=self.on_error)
        self.seq = 0
        self.url = url
        self.queue = []
        self.pending = []
        self.connected = False

        self.thread = nerve.Thread('WebsocketConnectionThread',
                                   target=self.run_forever)
        self.thread.daemon = True
        self.thread.start()
Ejemplo n.º 6
0
    def __init__(self, **config):
        nerve.Server.__init__(self, **config)

        self.username = self.get_setting("username")
        self.password = self.get_setting("password")

        socketserver.TCPServer.__init__(self, ('', self.get_setting('port')),
                                        IRCRequestHandler)
        #if self.get_setting('ssl_enable'):
        #    self.socket = ssl.wrap_socket(self.socket, certfile=self.get_setting('ssl_cert'), server_side=True)

        sa = self.socket.getsockname()
        nerve.log('starting http(s) on port ' + str(sa[1]))

        self.thread = nerve.Thread('HTTPServerThread',
                                   target=self.serve_forever)
        self.thread.daemon = True
        self.thread.start()
Ejemplo n.º 7
0
    def __init__(self, **config):
        super().__init__(**config)

        self.file = self.get_setting('file')
        self.baud = self.get_setting('baud')

        if not self.get_setting('enabled'):
            return

        self.thread = nerve.Thread('SerialThread', self.run)

        if sys.platform == 'win32':
            self.thread.daemon = True
            self.readline_func = self.readline_win32
        else:
            self.readline_func = self.readline_posix

        self.thread.start()
Ejemplo n.º 8
0
    def __init__(self, **config):
        super().__init__(**config)
        self.proc = None
        self.status = None
        self.current_pos = 0
        self.current_plid = 0
        self.playlist = None
        self.playlist_name = None
        self.next_update = 0

        self.server = 'localhost:8081'
        self.auth = ('', 'test')

        content = nerve.files.load('player-states.json')
        self.saved_states = json.loads(content) if content else []

        self.thread = nerve.Thread('VLCThread', self.run)
        self.thread.start()
Ejemplo n.º 9
0
def init_colour():
    global thread, colours, colours_reset

    import colorama

    colorama.init()

    colours_reset = colorama.Fore.RESET + colorama.Back.RESET + colorama.Style.RESET_ALL
    colours = {
        'info': '',
        'error': colorama.Style.BRIGHT + colorama.Fore.RED,
        'warning': colorama.Style.BRIGHT + colorama.Fore.YELLOW,
        'success': colorama.Fore.GREEN,
        'query': colorama.Style.BRIGHT + colorama.Fore.BLUE,
        'debug': colorama.Style.BRIGHT + colorama.Fore.BLACK,
        'event': colorama.Style.BRIGHT + colorama.Fore.CYAN,
        'notify': colorama.Style.BRIGHT + colorama.Fore.MAGENTA
    }

    thread = nerve.Thread('SerialThread', run_logger)
    thread.start()
Ejemplo n.º 10
0
 def __init__(self, **config):
     super().__init__(**config)
     self.thread = nerve.Thread('ConsoleThread', target=self.run)
     self.thread.daemon = True
     self.thread.start()