Implement _current_playlist_plchangesposid
This commit is contained in:
parent
e3b407c709
commit
1a7fbe671b
@ -443,6 +443,7 @@ class MpdHandler(object):
|
|||||||
To detect songs that were deleted at the end of the playlist, use
|
To detect songs that were deleted at the end of the playlist, use
|
||||||
``playlistlength`` returned by status command.
|
``playlistlength`` returned by status command.
|
||||||
"""
|
"""
|
||||||
|
# XXX Naive implementation that returns all tracks as changed
|
||||||
if int(version) < self.backend.current_playlist.version:
|
if int(version) < self.backend.current_playlist.version:
|
||||||
return self.backend.current_playlist.playlist.mpd_format()
|
return self.backend.current_playlist.playlist.mpd_format()
|
||||||
|
|
||||||
@ -460,7 +461,14 @@ class MpdHandler(object):
|
|||||||
To detect songs that were deleted at the end of the playlist, use
|
To detect songs that were deleted at the end of the playlist, use
|
||||||
``playlistlength`` returned by status command.
|
``playlistlength`` returned by status command.
|
||||||
"""
|
"""
|
||||||
raise MpdNotImplemented # TODO
|
# XXX Naive implementation that returns all tracks as changed
|
||||||
|
if int(version) != self.backend.current_playlist.version:
|
||||||
|
result = []
|
||||||
|
for position, track in enumerate(
|
||||||
|
self.backend.current_playlist.playlist.tracks):
|
||||||
|
result.append((u'cpos', position))
|
||||||
|
result.append((u'Id', track.id))
|
||||||
|
return result
|
||||||
|
|
||||||
@handle_pattern(r'^shuffle$')
|
@handle_pattern(r'^shuffle$')
|
||||||
@handle_pattern(r'^shuffle "(?P<start>\d+):(?P<end>\d+)*"$')
|
@handle_pattern(r'^shuffle "(?P<start>\d+):(?P<end>\d+)*"$')
|
||||||
|
|||||||
@ -699,12 +699,25 @@ class CurrentPlaylistHandlerTest(unittest.TestCase):
|
|||||||
self.assert_(u'ACK Not implemented' in result)
|
self.assert_(u'ACK Not implemented' in result)
|
||||||
|
|
||||||
def test_plchanges(self):
|
def test_plchanges(self):
|
||||||
|
self.b.current_playlist.load(Playlist(
|
||||||
|
tracks=[Track(name='a'), Track(name='b'), Track(name='c')]))
|
||||||
result = self.h.handle_request(u'plchanges "0"')
|
result = self.h.handle_request(u'plchanges "0"')
|
||||||
|
self.assert_(u'Title: a' in result)
|
||||||
|
self.assert_(u'Title: b' in result)
|
||||||
|
self.assert_(u'Title: c' in result)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_plchangesposid(self):
|
def test_plchangesposid(self):
|
||||||
|
self.b.current_playlist.load(Playlist(
|
||||||
|
tracks=[Track(id=11), Track(id=12), Track(id=13)]))
|
||||||
result = self.h.handle_request(u'plchangesposid "0"')
|
result = self.h.handle_request(u'plchangesposid "0"')
|
||||||
self.assert_(u'ACK Not implemented' in result)
|
self.assert_(u'cpos: 0' in result)
|
||||||
|
self.assert_(u'Id: 11' in result)
|
||||||
|
self.assert_(u'cpos: 2' in result)
|
||||||
|
self.assert_(u'Id: 12' in result)
|
||||||
|
self.assert_(u'cpos: 2' in result)
|
||||||
|
self.assert_(u'Id: 13' in result)
|
||||||
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_shuffle_without_range(self):
|
def test_shuffle_without_range(self):
|
||||||
result = self.h.handle_request(u'shuffle')
|
result = self.h.handle_request(u'shuffle')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user