Remove the FRONTENDS setting

This commit is contained in:
Stein Magnus Jodal 2013-04-01 20:22:29 +02:00
parent 74788a2ccb
commit aa1f8199c2
10 changed files with 21 additions and 65 deletions

View File

@ -20,8 +20,8 @@ The following requirements applies to any frontend implementation:
- 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 frontend is enabled if the extension it is part of is enabled. See
:ref:`extensiondev` for more information.
- The main actor MUST be able to start and stop the frontend when the main
actor is started and stopped.

View File

@ -36,12 +36,11 @@ Mopidy executable. If this isn't in place, the sound menu will not detect that
Mopidy is running.
Next, Mopidy's MPRIS frontend must be running for the sound menu to be able to
control Mopidy. The frontend is activated by default, so unless you've changed
the :attr:`mopidy.settings.FRONTENDS` setting, you should be good to go. Keep
an eye out for warnings or errors from the MPRIS frontend when you start
Mopidy, since it may fail because of missing dependencies or because Mopidy is
started outside of X; the frontend won't work if ``$DISPLAY`` isn't set when
Mopidy is started.
control Mopidy. The frontend is enabled by default, so as long as you have all
its dependencies available, you should be good to go. Keep an eye out for
warnings or errors from the MPRIS frontend when you start Mopidy, since it may
fail because of missing dependencies or because Mopidy is started outside of X;
the frontend won't work if ``$DISPLAY`` isn't set when Mopidy is started.
Under normal use, if Mopidy isn't running and you open the menu and click on
"Mopidy Music Server", a terminal window will open and automatically start

View File

@ -1,3 +1,5 @@
.. _extensiondev:
*********************
Extension development
*********************

View File

@ -25,8 +25,10 @@ from a web based client.
Setup
=====
When this frontend is included in :attr:`mopidy.settings.FRONTENDS`, it starts
a web server at the port specified by :attr:`mopidy.settings.HTTP_SERVER_PORT`.
The frontend is enabled by default if all dependencies are available.
When it is enabled it starts a web server at the port specified by
:attr:`mopidy.settings.HTTP_SERVER_PORT`.
.. warning:: Security
@ -364,15 +366,14 @@ event listeners, and delete the object like this:
Example to get started with
---------------------------
1. Create an empty directory for your web client.
1. Make sure that you've installed all dependencies required by the HTTP
frontend.
2. Change the setting :attr:`mopidy.settings.HTTP_SERVER_STATIC_DIR` to point
2. Create an empty directory for your web client.
3. Change the setting :attr:`mopidy.settings.HTTP_SERVER_STATIC_DIR` to point
to your new directory.
3. Make sure that you've included
``mopidy.frontends.http.HttpFrontend`` in
:attr:`mopidy.settings.FRONTENDS`.
4. Start/restart Mopidy.
5. Create a file in the directory named ``index.html`` containing e.g. "Hello,

View File

@ -24,9 +24,7 @@ Frontend which scrobbles the music you play to your `Last.fm
**Usage:**
Make sure :attr:`mopidy.settings.FRONTENDS` includes
``mopidy.frontends.lastfm.LastfmFrontend``. By default, the setting includes
the Last.fm frontend.
The frontend is enabled by default if all dependencies are available.
"""

View File

@ -22,9 +22,7 @@ original MPD server.
**Usage:**
Make sure :attr:`mopidy.settings.FRONTENDS` includes
``mopidy.frontends.mpd.MpdFrontend``. By default, the setting includes the MPD
frontend.
The frontend is enabled by default.
**Limitations:**

View File

@ -32,9 +32,7 @@ An example of an MPRIS client is the `Ubuntu Sound Menu
**Usage:**
Make sure :attr:`mopidy.settings.FRONTENDS` includes
``mopidy.frontends.mpris.MprisFrontend``. By default, the setting includes the
MPRIS frontend.
The frontend is enabled by default if all dependencies are available.
**Testing the frontend**

View File

@ -39,22 +39,6 @@ DEBUG_LOG_FILENAME = 'mopidy.log'
#: DESKTOP_FILE = u'/usr/share/applications/mopidy.desktop'
DESKTOP_FILE = '/usr/share/applications/mopidy.desktop'
#: List of server frontends to use. See :ref:`frontend-implementations` for
#: available frontends.
#:
#: Default::
#:
#: FRONTENDS = (
#: u'mopidy.frontends.mpd.MpdFrontend',
#: u'mopidy.frontends.lastfm.LastfmFrontend',
#: u'mopidy.frontends.mpris.MprisFrontend',
#: )
FRONTENDS = (
'mopidy.frontends.mpd.MpdFrontend',
'mopidy.frontends.lastfm.LastfmFrontend',
'mopidy.frontends.mpris.MprisFrontend',
)
#: Which address Mopidy's HTTP server should bind to.
#:
#: Used by :mod:`mopidy.frontends.http`.

View File

@ -123,7 +123,6 @@ def validate_settings(defaults, settings):
changed = {
'DUMP_LOG_FILENAME': 'DEBUG_LOG_FILENAME',
'DUMP_LOG_FORMAT': 'DEBUG_LOG_FORMAT',
'FRONTEND': 'FRONTENDS',
'GSTREAMER_AUDIO_SINK': 'OUTPUT',
'LOCAL_MUSIC_FOLDER': 'LOCAL_MUSIC_PATH',
'LOCAL_OUTPUT_OVERRIDE': 'OUTPUT',
@ -143,14 +142,9 @@ def validate_settings(defaults, settings):
}
must_be_iterable = [
'FRONTENDS',
'STREAM_PROTOCOLS',
]
must_have_value_set = [
'FRONTENDS',
]
for setting, value in settings.iteritems():
if setting in changed:
if changed[setting] is None:
@ -180,9 +174,6 @@ def validate_settings(defaults, settings):
'Must be a tuple. '
"Remember the comma after single values: (u'value',)")
elif setting in must_have_value_set and not value:
errors[setting] = 'Must be set.'
elif setting not in defaults and not setting.startswith('CUSTOM_'):
errors[setting] = 'Unknown setting.'
suggestion = did_you_mean(setting, defaults)

View File

@ -11,7 +11,6 @@ from tests import unittest
class ValidateSettingsTest(unittest.TestCase):
def setUp(self):
self.defaults = {
'FRONTENDS': ['a'],
'MPD_SERVER_HOSTNAME': '::',
'MPD_SERVER_PORT': 6600,
'SPOTIFY_BITRATE': 160,
@ -74,20 +73,6 @@ class ValidateSettingsTest(unittest.TestCase):
'SPOTIFY_USERNAME', None)
self.assertEqual(None, not_secret)
def test_empty_frontends_list_returns_error(self):
result = setting_utils.validate_settings(
self.defaults, {'FRONTENDS': []})
self.assertEqual(
result['FRONTENDS'], 'Must be set.')
def test_noniterable_multivalue_setting_returns_error(self):
result = setting_utils.validate_settings(
self.defaults, {'FRONTENDS': ('this is not a tuple')})
self.assertEqual(
result['FRONTENDS'],
'Must be a tuple. '
"Remember the comma after single values: (u'value',)")
class SettingsProxyTest(unittest.TestCase):
def setUp(self):