diff --git a/docs/changes.rst b/docs/changes.rst index 8fe79f23..f0a546af 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -25,21 +25,24 @@ v0.6.0 (in development) - The local client now tries to lookup where your music is via XDG, it will fall-back to ``~/music`` or use whatever setting you set manually. -- The idle command is now supported by mopidy for the following subsystems: - player, playlist, options and mixer (Fixes: :issue:`32`). +- The MPD command ``idle`` is now supported by Mopidy for the following + subsystems: player, playlist, options, and mixer. (Fixes: :issue:`32`) **Changes** - Replace :attr:`mopidy.backends.base.Backend.uri_handlers` with :attr:`mopidy.backends.base.Backend.uri_schemes`, which just takes the part up to the colon of an URI, and not any prefix. + - Add Listener API, :mod:`mopidy.listeners`, to be implemented by actors wanting to receive events from the backend. This is a formalization of the ad hoc events the Last.fm scrobbler has already been using for some time. + - Replaced all of the MPD network code that was provided by asyncore with - custom stack. This change was made to facilitate the future support of the - ``idle`` command, and to reduce the number of event loops being used. -- Fix metadata update in Shoutcast streaming (Fixes: :issue:`122`) + custom stack. This change was made to facilitate support for the ``idle`` + command, and to reduce the number of event loops being used. + +- Fix metadata update in Shoutcast streaming. (Fixes: :issue:`122`) v0.5.0 (2011-06-15) diff --git a/mopidy/frontends/mpd/protocol/status.py b/mopidy/frontends/mpd/protocol/status.py index 8fe83be5..0b5ff1df 100644 --- a/mopidy/frontends/mpd/protocol/status.py +++ b/mopidy/frontends/mpd/protocol/status.py @@ -137,7 +137,7 @@ def status(context): Reports the current status of the player and the volume level. - - ``volume``: 0-100 + - ``volume``: 0-100 (or -1 if no output is set). - ``repeat``: 0 or 1 - ``single``: 0 or 1 - ``consume``: 0 or 1 @@ -153,7 +153,8 @@ def status(context): - ``nextsongid``: playlist songid of the next song to be played - ``time``: total time elapsed (of current playing/paused song) - ``elapsed``: Total time elapsed within the current song, but with - higher resolution. + higher resolution (i.e. time in seconds with milliseconds in decimal + places). - ``bitrate``: instantaneous bitrate in kbps - ``xfade``: crossfade in seconds - ``audio``: sampleRate``:bits``:channels @@ -242,17 +243,11 @@ def _status_state(futures): return u'pause' def _status_time(futures): - return u'%s:%s' % (_status_time_elapsed(futures) // 1000, + return u'%d:%d' % (futures['playback.time_position'].get() // 1000, _status_time_total(futures) // 1000) def _status_time_elapsed(futures): - time_position = futures['playback.time_position'].get() - if time_position < 1000: - # XXX ncmpcpp and mpc interpretes the elapsed time as seconds instead - # of milliseconds if the elapsed time is less than approx. 1000. - return 0 - else: - return time_position + return u'%.3f' % (futures['playback.time_position'].get() / 1000.0) def _status_time_total(futures): current_cp_track = futures['playback.current_cp_track'].get() diff --git a/tests/frontends/mpd/status_test.py b/tests/frontends/mpd/status_test.py index a7eeeb5e..2f97a7d4 100644 --- a/tests/frontends/mpd/status_test.py +++ b/tests/frontends/mpd/status_test.py @@ -163,14 +163,14 @@ class StatusHandlerTest(unittest.TestCase): self.backend.playback.play_time_accumulated = 59123 result = dict(status.status(self.context)) self.assert_('elapsed' in result) - self.assertEqual(int(result['elapsed']), 59123) + self.assertEqual(result['elapsed'], '59.123') def test_status_method_when_starting_playing_contains_elapsed_zero(self): self.backend.playback.state = PAUSED self.backend.playback.play_time_accumulated = 123 # Less than 1000ms result = dict(status.status(self.context)) self.assert_('elapsed' in result) - self.assertEqual(int(result['elapsed']), 0) # Zero + self.assertEqual(result['elapsed'], '0.123') def test_status_method_when_playing_contains_bitrate(self): self.backend.current_playlist.append([Track(bitrate=320)])