Merge pull request #378 from jodal/feature/remove-backends-and-frontends-settings

Remove backends and frontends settings
This commit is contained in:
Thomas Adamcik 2013-04-01 11:29:18 -07:00
commit 55e798c806
13 changed files with 22 additions and 102 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

@ -281,12 +281,6 @@ settings file in the following way::
import os
profile = os.environ.get('PROFILE', '').split(',')
if 'spotify' in profile:
BACKENDS = (u'mopidy.backends.spotify.SpotifyBackend',)
elif 'local' in profile:
BACKENDS = (u'mopidy.backends.local.LocalBackend',)
LOCAL_MUSIC_PATH = u'~/music'
if 'shoutcast' in profile:
OUTPUT = u'lame ! shout2send mount="/stream"'
elif 'silent' in profile:
@ -296,7 +290,7 @@ settings file in the following way::
SPOTIFY_USERNAME = u'xxxxx'
SPOTIFY_PASSWORD = u'xxxxx'
Using this setup you can now run Mopidy with ``PROFILE=silent,spotify mopidy``
Using this setup you can now run Mopidy with ``PROFILE=silent mopidy``
if you for instance want to test Spotify without any actual audio output.

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

@ -9,25 +9,6 @@ All available settings and their default values.
from __future__ import unicode_literals
#: List of playback backends to use. See :ref:`backend-implementations` for all
#: available backends.
#:
#: When results from multiple backends are combined, they are combined in the
#: order the backends are listed here.
#:
#: Default::
#:
#: BACKENDS = (
#: u'mopidy.backends.local.LocalBackend',
#: u'mopidy.backends.spotify.SpotifyBackend',
#: u'mopidy.backends.stream.StreamBackend',
#: )
BACKENDS = (
'mopidy.backends.local.LocalBackend',
'mopidy.backends.spotify.SpotifyBackend',
'mopidy.backends.stream.StreamBackend',
)
#: The log format used for informational logging.
#:
#: See http://docs.python.org/2/library/logging.html#formatter-objects for
@ -58,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,16 +142,9 @@ def validate_settings(defaults, settings):
}
must_be_iterable = [
'BACKENDS',
'FRONTENDS',
'STREAM_PROTOCOLS',
]
must_have_value_set = [
'BACKENDS',
'FRONTENDS',
]
for setting, value in settings.iteritems():
if setting in changed:
if changed[setting] is None:
@ -182,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

@ -17,7 +17,6 @@ class LocalPlaybackControllerTest(PlaybackControllerTest, unittest.TestCase):
Track(uri=generate_song(i), length=4464) for i in range(1, 4)]
def setUp(self):
settings.BACKENDS = ('mopidy.backends.local.LocalBackend',)
settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache')
super(LocalPlaybackControllerTest, self).setUp()

View File

@ -15,7 +15,6 @@ class LocalTracklistControllerTest(TracklistControllerTest, unittest.TestCase):
Track(uri=generate_song(i), length=4464) for i in range(1, 4)]
def setUp(self):
settings.BACKENDS = ('mopidy.backends.local.LocalBackend',)
settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache')
super(LocalTracklistControllerTest, self).setUp()

View File

@ -11,8 +11,6 @@ from tests import unittest
class ValidateSettingsTest(unittest.TestCase):
def setUp(self):
self.defaults = {
'BACKENDS': ['a'],
'FRONTENDS': ['a'],
'MPD_SERVER_HOSTNAME': '::',
'MPD_SERVER_PORT': 6600,
'SPOTIFY_BITRATE': 160,
@ -75,26 +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_empty_backends_list_returns_error(self):
result = setting_utils.validate_settings(
self.defaults, {'BACKENDS': []})
self.assertEqual(
result['BACKENDS'], '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):