Move MPD server into its own process

This commit is contained in:
Stein Magnus Jodal 2010-08-20 01:24:56 +02:00
parent d43ddab590
commit 88a4d64a59
4 changed files with 26 additions and 7 deletions

View File

@ -39,8 +39,6 @@ greatly improved MPD client support.
the packages created by ``setup.py`` for i.e. PyPI.
- MPD frontend:
- Relocate from :mod:`mopidy.mpd` to :mod:`mopidy.frontends.mpd`.
- Split gigantic protocol implementation into eleven modules.
- Search improvements, including support for multi-word search.
- Fixed ``play "-1"`` and ``playid "-1"`` behaviour when playlist is empty
or when a current track is set.
@ -56,11 +54,14 @@ greatly improved MPD client support.
- Fix ``load`` so that one can append a playlist to the current playlist, and
make it return the correct error message if the playlist is not found.
- Support for single track repeat added. (Fixes: :issue:`4`)
- Relocate from :mod:`mopidy.mpd` to :mod:`mopidy.frontends.mpd`.
- Split gigantic protocol implementation into eleven modules.
- Rename ``mopidy.frontends.mpd.{serializer => translator}`` to match naming
in backends.
- Remove setting :attr:`mopidy.settings.SERVER` and
:attr:`mopidy.settings.FRONTEND` in favour of the new
:attr:`mopidy.settings.FRONTENDS`.
- Run MPD server in its own process.
- Backends:

View File

@ -30,7 +30,8 @@ def main():
frontend.start_server(core_queue)
core = CoreProcess(core_queue, output_class, backend_class, frontend)
core.start()
asyncore.loop()
#asyncore.loop()
logger.debug('Main done')
def _parse_options():
parser = optparse.OptionParser(version='Mopidy %s' % get_version())

View File

@ -1,5 +1,5 @@
from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.server import MpdServer
from mopidy.frontends.mpd.process import MpdProcess
class MpdFrontend(object):
"""
@ -17,8 +17,8 @@ class MpdFrontend(object):
:param core_queue: the core queue
:type core_queue: :class:`multiprocessing.Queue`
"""
self.server = MpdServer(core_queue)
self.server.start()
self.process = MpdProcess(core_queue)
self.process.start()
def create_dispatcher(self, backend):
"""
@ -28,6 +28,5 @@ class MpdFrontend(object):
:type backend: :class:`mopidy.backends.base.BaseBackend`
:rtype: :class:`mopidy.frontends.mpd.dispatcher.MpdDispatcher`
"""
self.dispatcher = MpdDispatcher(backend)
return self.dispatcher

View File

@ -0,0 +1,18 @@
import asyncore
import logging
from mopidy.frontends.mpd.server import MpdServer
from mopidy.utils.process import BaseProcess
logger = logging.getLogger('mopidy.frontends.mpd.process')
class MpdProcess(BaseProcess):
def __init__(self, core_queue):
super(MpdProcess, self).__init__()
self.core_queue = core_queue
def run_inside_try(self):
logger.debug(u'Starting MPD server process')
server = MpdServer(self.core_queue)
server.start()
asyncore.loop()