Update frontend to match CPC.get() changes
This commit is contained in:
parent
6d46d77b7a
commit
332d917b53
@ -302,7 +302,7 @@ class MpdFrontend(object):
|
||||
try:
|
||||
track = self.backend.current_playlist.get(id=songid)
|
||||
return self.backend.current_playlist.remove(track)
|
||||
except KeyError as e:
|
||||
except LookupError as e:
|
||||
raise MpdAckError(e[0])
|
||||
|
||||
@handle_pattern(r'^clear$')
|
||||
@ -390,7 +390,7 @@ class MpdFrontend(object):
|
||||
try:
|
||||
track = self.backend.current_playlist.get(uri=needle)
|
||||
return track.mpd_format()
|
||||
except KeyError:
|
||||
except LookupError:
|
||||
return None
|
||||
raise MpdNotImplemented # TODO
|
||||
|
||||
@ -409,7 +409,7 @@ class MpdFrontend(object):
|
||||
songid = int(songid)
|
||||
track = self.backend.current_playlist.get(id=songid)
|
||||
return track.mpd_format()
|
||||
except KeyError as e:
|
||||
except LookupError as e:
|
||||
raise MpdAckError(e[0])
|
||||
else:
|
||||
return self.backend.current_playlist.playlist.mpd_format()
|
||||
@ -834,7 +834,7 @@ class MpdFrontend(object):
|
||||
else:
|
||||
track = self.backend.current_playlist.get(id=songid)
|
||||
return self.backend.playback.play(track)
|
||||
except KeyError as e:
|
||||
except LookupError as e:
|
||||
raise MpdAckError(e[0])
|
||||
|
||||
@handle_pattern(r'^play "(?P<songpos>\d+)"$')
|
||||
|
||||
@ -476,7 +476,7 @@ class PlaybackControlHandlerTest(unittest.TestCase):
|
||||
def test_playid_which_does_not_exist(self):
|
||||
self.b.current_playlist.load(Playlist(tracks=[Track(id=0)]))
|
||||
result = self.h.handle_request(u'playid "1"')
|
||||
self.assert_(u'ACK Track matching "id=1" not found' in result)
|
||||
self.assert_(u'ACK "id=1" match no tracks' in result)
|
||||
|
||||
def test_previous(self):
|
||||
result = self.h.handle_request(u'previous')
|
||||
@ -598,7 +598,7 @@ class CurrentPlaylistHandlerTest(unittest.TestCase):
|
||||
self.assertEquals(self.b.current_playlist.playlist.length, 2)
|
||||
result = self.h.handle_request(u'deleteid "0"')
|
||||
self.assertEquals(self.b.current_playlist.playlist.length, 2)
|
||||
self.assert_(u'ACK Track matching "id=0" not found' in result)
|
||||
self.assert_(u'ACK "id=0" match no tracks' in result)
|
||||
|
||||
def test_move_songpos(self):
|
||||
self.b.current_playlist.load(Playlist(tracks=[
|
||||
@ -700,7 +700,7 @@ class CurrentPlaylistHandlerTest(unittest.TestCase):
|
||||
self.b.current_playlist.load(Playlist(
|
||||
tracks=[Track(name='a', id=33), Track(name='b', id=38)]))
|
||||
result = self.h.handle_request(u'playlistid "25"')
|
||||
self.assert_(u'ACK Track matching "id=25" not found' in result)
|
||||
self.assert_(u'ACK "id=25" match no tracks' in result)
|
||||
|
||||
def test_playlistinfo_without_songpos_or_range(self):
|
||||
result = self.h.handle_request(u'playlistinfo')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user