From 556e6ba4d9bc32384526501acbbc4c0c2b6f983e Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 24 Aug 2010 01:25:27 +0200 Subject: [PATCH] Make MpdFrontend a subclass of BaseFrontend --- mopidy/frontends/mpd/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mopidy/frontends/mpd/__init__.py b/mopidy/frontends/mpd/__init__.py index 8e7d65ab..f1bfdd57 100644 --- a/mopidy/frontends/mpd/__init__.py +++ b/mopidy/frontends/mpd/__init__.py @@ -1,12 +1,13 @@ import logging +from mopidy.frontends.base import BaseFrontend from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.process import MpdProcess from mopidy.utils.process import unpickle_connection logger = logging.getLogger('mopidy.frontends.mpd') -class MpdFrontend(object): +class MpdFrontend(BaseFrontend): """ The MPD frontend. @@ -16,16 +17,20 @@ class MpdFrontend(object): - :attr:`mopidy.settings.MPD_SERVER_PORT` """ - def __init__(self, core_queue, backend): - self.core_queue = core_queue + def __init__(self, *args, **kwargs): + super(MpdFrontend, self).__init__(*args, **kwargs) self.process = None - self.dispatcher = MpdDispatcher(backend) + self.dispatcher = MpdDispatcher(self.backend) def start(self): """Starts the MPD server.""" self.process = MpdProcess(self.core_queue) self.process.start() + def destroy(self): + """Destroys the MPD server.""" + self.process.destroy() + def process_message(self, message): """ Processes messages with the MPD frontend as destination.