docs: Add docs for mopidy.mpd.server

This commit is contained in:
Stein Magnus Jodal 2010-03-20 02:39:54 +01:00
parent da441b36b3
commit 935d7a707d
3 changed files with 29 additions and 5 deletions

View File

@ -1,8 +1,20 @@
************************************************
:mod:`mopidy.mpd` -- MPD protocol implementation
************************************************
*****************
:mod:`mopidy.mpd`
*****************
MPD protocol implementation
===========================
.. automodule:: mopidy.mpd.frontend
:synopsis: Our implementation of the MPD protocol.
:members:
:undoc-members:
MPD server implementation
=========================
.. automodule:: mopidy.mpd.server
:synopsis: Our MPD server implementation.
:members:
:undoc-members:

View File

@ -1,5 +1,5 @@
"""
Our MPD protocol implementation
This is our MPD protocol implementation.
This is partly based upon the `MPD protocol documentation
<http://www.musicpd.org/doc/protocol/>`_, which is a useful resource, but it is

View File

@ -1,3 +1,7 @@
"""
This is our MPD server implementation.
"""
import asynchat
import asyncore
import logging
@ -17,7 +21,11 @@ ENCODING = u'utf-8'
LINE_TERMINATOR = u'\n'
class MpdServer(asyncore.dispatcher):
def __init__(self, core_queue=None):
"""
The MPD server. Creates a :class:`MpdSession` for each client connection.
"""
def __init__(self, core_queue):
asyncore.dispatcher.__init__(self)
self.core_queue = core_queue
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
@ -47,6 +55,10 @@ class MpdServer(asyncore.dispatcher):
class MpdSession(asynchat.async_chat):
"""
The MPD client session. Dispatches MPD requests to the frontend.
"""
def __init__(self, server, client_socket, client_address, core_queue):
asynchat.async_chat.__init__(self, sock=client_socket)
self.server = server