Make MpdFrontend a subclass of BaseFrontend

This commit is contained in:
Stein Magnus Jodal 2010-08-24 01:25:27 +02:00
parent f42d226491
commit 556e6ba4d9

View File

@ -1,12 +1,13 @@
import logging import logging
from mopidy.frontends.base import BaseFrontend
from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.process import MpdProcess from mopidy.frontends.mpd.process import MpdProcess
from mopidy.utils.process import unpickle_connection from mopidy.utils.process import unpickle_connection
logger = logging.getLogger('mopidy.frontends.mpd') logger = logging.getLogger('mopidy.frontends.mpd')
class MpdFrontend(object): class MpdFrontend(BaseFrontend):
""" """
The MPD frontend. The MPD frontend.
@ -16,16 +17,20 @@ class MpdFrontend(object):
- :attr:`mopidy.settings.MPD_SERVER_PORT` - :attr:`mopidy.settings.MPD_SERVER_PORT`
""" """
def __init__(self, core_queue, backend): def __init__(self, *args, **kwargs):
self.core_queue = core_queue super(MpdFrontend, self).__init__(*args, **kwargs)
self.process = None self.process = None
self.dispatcher = MpdDispatcher(backend) self.dispatcher = MpdDispatcher(self.backend)
def start(self): def start(self):
"""Starts the MPD server.""" """Starts the MPD server."""
self.process = MpdProcess(self.core_queue) self.process = MpdProcess(self.core_queue)
self.process.start() self.process.start()
def destroy(self):
"""Destroys the MPD server."""
self.process.destroy()
def process_message(self, message): def process_message(self, message):
""" """
Processes messages with the MPD frontend as destination. Processes messages with the MPD frontend as destination.