Make MpdFrontend start

This commit is contained in:
Stein Magnus Jodal 2011-03-07 22:42:55 +01:00
parent 43cb8d077c
commit d75ca5b4e8
3 changed files with 4 additions and 8 deletions

View File

@ -37,6 +37,6 @@ class MpdThread(BaseThread):
def run_inside_try(self):
logger.debug(u'Starting MPD server thread')
server = MpdServer(self.core_queue)
server = MpdServer()
server.start()
asyncore.loop()

View File

@ -15,9 +15,8 @@ class MpdServer(asyncore.dispatcher):
for each client connection.
"""
def __init__(self, core_queue):
def __init__(self):
asyncore.dispatcher.__init__(self)
self.core_queue = core_queue
def start(self):
"""Start MPD server."""
@ -47,8 +46,7 @@ class MpdServer(asyncore.dispatcher):
(client_socket, client_socket_address) = self.accept()
logger.info(u'MPD client connection from [%s]:%s',
client_socket_address[0], client_socket_address[1])
MpdSession(self, client_socket, client_socket_address,
self.core_queue).start()
MpdSession(self, client_socket, client_socket_address).start()
def handle_close(self):
"""Handle end of client connection."""

View File

@ -14,13 +14,11 @@ class MpdSession(asynchat.async_chat):
MPD requests to the dispatcher.
"""
def __init__(self, server, client_socket, client_socket_address,
core_queue):
def __init__(self, server, client_socket, client_socket_address):
asynchat.async_chat.__init__(self, sock=client_socket)
self.server = server
self.client_address = client_socket_address[0]
self.client_port = client_socket_address[1]
self.core_queue = core_queue
self.input_buffer = []
self.authenticated = False
self.set_terminator(LINE_TERMINATOR.encode(ENCODING))