Merge branch 'develop' into gstreamer-local-backend

This commit is contained in:
Thomas Adamcik 2010-08-18 23:32:45 +02:00
commit 70dd200365
4 changed files with 18 additions and 17 deletions

View File

@ -57,6 +57,8 @@ Stuff we want to do, but not right now, and maybe never
- Frontends:
- Publish the server's presence to the network using `Zeroconf
<http://en.wikipedia.org/wiki/Zeroconf>`_/Avahi.
- D-Bus/`MPRIS <http://www.mpris.org/>`_
- REST/JSON web service with a jQuery client as example application. Maybe
based upon `Tornado <http://github.com/facebook/tornado>`_ and `jQuery

View File

@ -307,6 +307,9 @@ class BasePlaybackController(object):
Typically called by :class:`mopidy.process.CoreProcess` after a message
from a library thread is received.
"""
if self.state == self.STOPPED:
return
original_cp_track = self.current_cp_track
if self.cp_track_at_eot:
self.play(self.cp_track_at_eot)

View File

@ -12,11 +12,9 @@ logger = logging.getLogger('mopidy.utils.settings')
class SettingsProxy(object):
def __init__(self, default_settings_module):
self.default_settings = self._get_settings_dict_from_module(
self.default = self._get_settings_dict_from_module(
default_settings_module)
self.local_settings = self._get_local_settings()
self.raw_settings = copy(self.default_settings)
self.raw_settings.update(self.local_settings)
self.local = self._get_local_settings()
def _get_local_settings(self):
dotdir = os.path.expanduser(u'~/.mopidy/')
@ -35,12 +33,18 @@ class SettingsProxy(object):
def _is_setting(self, name):
return name.isupper()
@property
def current(self):
current = copy(self.default)
current.update(self.local)
return current
def __getattr__(self, attr):
if not self._is_setting(attr):
return
if attr not in self.raw_settings:
if attr not in self.current:
raise SettingsError(u'Setting "%s" is not set.' % attr)
value = self.raw_settings[attr]
value = self.current[attr]
if type(value) != bool and not value:
raise SettingsError(u'Setting "%s" is empty.' % attr)
return value
@ -52,7 +56,7 @@ class SettingsProxy(object):
raise SettingsError(u'Settings validation failed.')
def get_errors(self):
return validate_settings(self.default_settings, self.local_settings)
return validate_settings(self.default, self.local)
def get_errors_as_string(self):
lines = []
@ -114,8 +118,8 @@ def list_settings_optparse_callback(*args):
from mopidy import settings
errors = settings.get_errors()
lines = []
for (key, value) in sorted(settings.raw_settings.iteritems()):
default_value = settings.default_settings.get(key)
for (key, value) in sorted(settings.current.iteritems()):
default_value = settings.default.get(key)
if key.endswith('PASSWORD'):
value = u'********'
lines.append(u'%s:' % key)

View File

@ -683,14 +683,6 @@ class BasePlaybackControllerTest(object):
self.playback.on_end_of_track()
self.assert_(self.tracks[0] not in self.backend.current_playlist.tracks)
@populate_playlist
def test_end_of_track_with_single_and_repeat(self):
self.playback.single = True
self.playback.repeat = True
self.playback.play()
self.playback.on_end_of_track()
self.assertEqual(self.playback.current_track, self.tracks[1])
@populate_playlist
def test_end_of_track_with_random(self):
# FIXME feels very fragile