Replace redundant BaseFrontend class with list of requirements for frontend implementations
This commit is contained in:
parent
32bf7af73f
commit
83d2601f68
@ -2,22 +2,26 @@
|
||||
Frontend API
|
||||
************
|
||||
|
||||
A frontend may do whatever it wants to, including creating threads, opening TCP
|
||||
ports and exposing Mopidy for a type of clients.
|
||||
|
||||
Frontends got one main limitation: they are restricted to passing messages
|
||||
through the ``core_queue`` for all communication with the rest of Mopidy. Thus,
|
||||
the frontend API is very small and reveals little of what a frontend may do.
|
||||
|
||||
.. warning::
|
||||
|
||||
A stable frontend API is not available yet, as we've only implemented a
|
||||
couple of frontend modules.
|
||||
|
||||
.. automodule:: mopidy.frontends.base
|
||||
:synopsis: Base class for frontends
|
||||
:members:
|
||||
The following requirements applies to any frontend implementation:
|
||||
|
||||
- A frontend MAY do mostly whatever it wants to, including creating threads,
|
||||
opening TCP ports and exposing Mopidy for a group of clients.
|
||||
- A frontend MUST implement at least one `Pykka
|
||||
<http://jodal.github.com/pykka/>`_ actor, called the "main actor" from here
|
||||
on.
|
||||
- It MAY use additional actors to implement whatever it does, and using actors
|
||||
in frontend implementations is encouraged.
|
||||
- The frontend is activated by including its main actor in the
|
||||
:attr:`mopidy.settings.FRONTENDS` setting.
|
||||
- The main actor MUST be able to start and stop the frontend when the main
|
||||
actor is started and stopped.
|
||||
- The frontend MAY require additional settings to be set for it to
|
||||
work.
|
||||
- Such settings MUST be documented.
|
||||
- The main actor MUST stop itself if the defined settings are not adequate for
|
||||
the frontend to work properly.
|
||||
- Any actor which is part of the frontend MAY implement any listener interface
|
||||
from :mod:`mopidy.listeners` to receive notification of the specified events.
|
||||
|
||||
Frontend implementations
|
||||
========================
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
class BaseFrontend(object):
|
||||
"""
|
||||
Base class for frontends.
|
||||
"""
|
||||
pass
|
||||
@ -10,7 +10,6 @@ except ImportError as import_error:
|
||||
from pykka.actor import ThreadingActor
|
||||
|
||||
from mopidy import settings, SettingsError
|
||||
from mopidy.frontends.base import BaseFrontend
|
||||
from mopidy.listeners import BackendListener
|
||||
|
||||
logger = logging.getLogger('mopidy.frontends.lastfm')
|
||||
@ -18,7 +17,7 @@ logger = logging.getLogger('mopidy.frontends.lastfm')
|
||||
API_KEY = '2236babefa8ebb3d93ea467560d00d04'
|
||||
API_SECRET = '94d9a09c0cd5be955c4afaeaffcaefcd'
|
||||
|
||||
class LastfmFrontend(ThreadingActor, BaseFrontend, BackendListener):
|
||||
class LastfmFrontend(ThreadingActor, BackendListener):
|
||||
"""
|
||||
Frontend which scrobbles the music you play to your `Last.fm
|
||||
<http://www.last.fm>`_ profile.
|
||||
|
||||
@ -3,13 +3,12 @@ import logging
|
||||
|
||||
from pykka.actor import ThreadingActor
|
||||
|
||||
from mopidy.frontends.base import BaseFrontend
|
||||
from mopidy.frontends.mpd.server import MpdServer
|
||||
from mopidy.utils.process import BaseThread
|
||||
|
||||
logger = logging.getLogger('mopidy.frontends.mpd')
|
||||
|
||||
class MpdFrontend(ThreadingActor, BaseFrontend):
|
||||
class MpdFrontend(ThreadingActor):
|
||||
"""
|
||||
The MPD frontend.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user