From 7039031161dc3e6e5677164edb60566337810348 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 31 Mar 2010 20:49:58 +0200 Subject: [PATCH] Update frontend to use new BaseCurrentPlaylistController.get() --- mopidy/mpd/frontend.py | 14 +++++++------- tests/mpd/frontend_test.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mopidy/mpd/frontend.py b/mopidy/mpd/frontend.py index c3ce90a1..5c18f802 100644 --- a/mopidy/mpd/frontend.py +++ b/mopidy/mpd/frontend.py @@ -300,7 +300,7 @@ class MpdFrontend(object): """ songid = int(songid) try: - track = self.backend.current_playlist.get_by_id(songid) + track = self.backend.current_playlist.get(id=songid) return self.backend.current_playlist.remove(track) except KeyError as e: raise MpdAckError(e[0]) @@ -353,7 +353,7 @@ class MpdFrontend(object): """ songid = int(songid) to = int(to) - track = self.backend.current_playlist.get_by_id(songid) + track = self.backend.current_playlist.get(id=songid) position = self.backend.current_playlist.playlist.tracks.index(track) self.backend.current_playlist.move(position, position + 1, to) @@ -388,7 +388,7 @@ class MpdFrontend(object): """ if tag == 'filename': try: - track = self.backend.current_playlist.get_by_uri(needle) + track = self.backend.current_playlist.get(uri=needle) return track.mpd_format() except KeyError: return None @@ -407,7 +407,7 @@ class MpdFrontend(object): if songid is not None: try: songid = int(songid) - track = self.backend.current_playlist.get_by_id(songid) + track = self.backend.current_playlist.get(id=songid) return track.mpd_format() except KeyError as e: raise MpdAckError(e[0]) @@ -549,8 +549,8 @@ class MpdFrontend(object): """ songid1 = int(songid1) songid2 = int(songid2) - song1 = self.backend.current_playlist.get_by_id(songid1) - song2 = self.backend.current_playlist.get_by_id(songid2) + song1 = self.backend.current_playlist.get(id=songid1) + song2 = self.backend.current_playlist.get(id=songid2) songpos1 = self.backend.current_playlist.playlist.tracks.index(song1) songpos2 = self.backend.current_playlist.playlist.tracks.index(song2) self._current_playlist_swap(songpos1, songpos2) @@ -832,7 +832,7 @@ class MpdFrontend(object): if songid == -1: track = self.backend.current_playlist.playlist.tracks[0] else: - track = self.backend.current_playlist.get_by_id(songid) + track = self.backend.current_playlist.get(id=songid) return self.backend.playback.play(track) except KeyError as e: raise MpdAckError(e[0]) diff --git a/tests/mpd/frontend_test.py b/tests/mpd/frontend_test.py index ba3d0fec..ffb6da67 100644 --- a/tests/mpd/frontend_test.py +++ b/tests/mpd/frontend_test.py @@ -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 with ID "1" not found' in result) + self.assert_(u'ACK Track matching "id=1" not found' 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 with ID "0" not found' in result) + self.assert_(u'ACK Track matching "id=0" not found' 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 with ID "25" not found' in result) + self.assert_(u'ACK Track matching "id=25" not found' in result) def test_playlistinfo_without_songpos_or_range(self): result = self.h.handle_request(u'playlistinfo')