From 7b711e4daceb1f3fd2066afdeeca7d874bd0a354 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 21 Jul 2015 14:01:45 +0200 Subject: [PATCH] mpd: Add rangeid command skeleton --- docs/changelog.rst | 5 +++++ mopidy/mpd/protocol/current_playlist.py | 16 ++++++++++++++++ tests/mpd/protocol/test_current_playlist.py | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1558042b..eebc3b0c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -57,6 +57,11 @@ MPD frontend instead of "A, B". This is a part of updating our protocol implementation to match MPD 0.19. (PR: :issue:`1213`) +- Add skeletons of new or otherwise missing MPD commands that return a "not + implemented" error: + + - ``rangeid`` + File backend ------------ diff --git a/mopidy/mpd/protocol/current_playlist.py b/mopidy/mpd/protocol/current_playlist.py index da1a69d1..6eeeccf5 100644 --- a/mopidy/mpd/protocol/current_playlist.py +++ b/mopidy/mpd/protocol/current_playlist.py @@ -355,6 +355,22 @@ def prioid(context, *args): pass +@protocol.commands.add('rangeid', tlid=protocol.UINT, songrange=protocol.RANGE) +def rangeid(context, tlid, songrange): + """ + *musicpd.org, current playlist section:* + + ``rangeid {ID} {START:END}`` + + Specifies the portion of the song that shall be played. START and END + are offsets in seconds (fractional seconds allowed); both are optional. + Omitting both (i.e. sending just ":") means "remove the range, play + everything". A song that is currently playing cannot be manipulated + this way. + """ + raise exceptions.MpdNotImplemented # TODO + + @protocol.commands.add('shuffle', songrange=protocol.RANGE) def shuffle(context, songrange=None): """ diff --git a/tests/mpd/protocol/test_current_playlist.py b/tests/mpd/protocol/test_current_playlist.py index 3b7540b5..7bd4157a 100644 --- a/tests/mpd/protocol/test_current_playlist.py +++ b/tests/mpd/protocol/test_current_playlist.py @@ -386,6 +386,13 @@ class PlChangeCommandTest(BasePopulatedTracklistTestCase): self.assertInResponse('OK') +class RangeIdCommandTest(protocol.BaseTestCase): + + def test_rangeid(self): + self.send_request('rangeid 17 0:30') + self.assertEqualResponse('ACK [0@0] {rangeid} Not implemented') + + # TODO: we only seem to be testing that don't touch the non shuffled region :/ class ShuffleCommandTest(BasePopulatedTracklistTestCase):