diff --git a/docs/api/frontends.rst b/docs/api/frontends.rst index 8488b408..a6e6f500 100644 --- a/docs/api/frontends.rst +++ b/docs/api/frontends.rst @@ -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. diff --git a/docs/clients/mpris.rst b/docs/clients/mpris.rst index c782fa26..28da63ed 100644 --- a/docs/clients/mpris.rst +++ b/docs/clients/mpris.rst @@ -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 diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 04c6aa6b..976f8f84 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -1,3 +1,5 @@ +.. _extensiondev: + ********************* Extension development ********************* diff --git a/mopidy/frontends/http/__init__.py b/mopidy/frontends/http/__init__.py index 0107e357..7b99efd0 100644 --- a/mopidy/frontends/http/__init__.py +++ b/mopidy/frontends/http/__init__.py @@ -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, diff --git a/mopidy/frontends/lastfm/__init__.py b/mopidy/frontends/lastfm/__init__.py index df41d130..439ada50 100644 --- a/mopidy/frontends/lastfm/__init__.py +++ b/mopidy/frontends/lastfm/__init__.py @@ -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. """ diff --git a/mopidy/frontends/mpd/__init__.py b/mopidy/frontends/mpd/__init__.py index 10334bcf..5cb8b8c0 100644 --- a/mopidy/frontends/mpd/__init__.py +++ b/mopidy/frontends/mpd/__init__.py @@ -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:** diff --git a/mopidy/frontends/mpris/__init__.py b/mopidy/frontends/mpris/__init__.py index 268a9bc2..940c4210 100644 --- a/mopidy/frontends/mpris/__init__.py +++ b/mopidy/frontends/mpris/__init__.py @@ -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** diff --git a/mopidy/settings.py b/mopidy/settings.py index 7df43ae5..cde6430a 100644 --- a/mopidy/settings.py +++ b/mopidy/settings.py @@ -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`. diff --git a/mopidy/utils/settings.py b/mopidy/utils/settings.py index 011b723a..051f0f1c 100644 --- a/mopidy/utils/settings.py +++ b/mopidy/utils/settings.py @@ -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) diff --git a/tests/utils/settings_test.py b/tests/utils/settings_test.py index 4e7d9d77..2c13066c 100644 --- a/tests/utils/settings_test.py +++ b/tests/utils/settings_test.py @@ -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):