diff --git a/docs/changes.rst b/docs/changes.rst index 77c418bf..d664872b 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -158,6 +158,9 @@ backends: - Remove :attr:`mopidy.core.PlaybackController.track_at_eot`. Use :attr:`mopidy.core.PlaybackController.tl_track_at_eot` instead. +- Remove :attr:`mopidy.core.PlaybackController.current_tlid`. Use + :attr:`mopidy.core.PlaybackController.current_tl_track` instead. + - Added support for connecting to the Spotify service through an HTTP or SOCKS proxy, which is supported by pyspotify >= 1.9. diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index 901c7e34..94fd7d4e 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -79,17 +79,6 @@ class PlaybackController(object): uri_scheme = urlparse.urlparse(uri).scheme return self.backends.with_playback_by_uri_scheme.get(uri_scheme, None) - def get_current_tlid(self): - return self.current_tl_track and self.current_tl_track.tlid - - current_tlid = property(get_current_tlid) - """ - The TLID (tracklist ID) of the currently playing or selected - track. - - Read-only. Extracted from :attr:`current_tl_track` for convenience. - """ - def get_current_track(self): return self.current_tl_track and self.current_tl_track.track diff --git a/mopidy/frontends/mpd/protocol/current_playlist.py b/mopidy/frontends/mpd/protocol/current_playlist.py index da950078..69e04d4b 100644 --- a/mopidy/frontends/mpd/protocol/current_playlist.py +++ b/mopidy/frontends/mpd/protocol/current_playlist.py @@ -110,7 +110,8 @@ def deleteid(context, tlid): Deletes the song ``SONGID`` from the playlist """ tlid = int(tlid) - if context.core.playback.current_tlid.get() == tlid: + tl_track = context.core.playback.current_tl_track.get() + if tl_track and tl_track.tlid == tlid: context.core.playback.next() tl_tracks = context.core.tracklist.remove(tlid=tlid).get() if not tl_tracks: diff --git a/mopidy/frontends/mpd/protocol/playback.py b/mopidy/frontends/mpd/protocol/playback.py index d166f982..5a4569e1 100644 --- a/mopidy/frontends/mpd/protocol/playback.py +++ b/mopidy/frontends/mpd/protocol/playback.py @@ -329,9 +329,9 @@ def seek(context, songpos, seconds): - issues ``seek 1 120`` without quotes around the arguments. """ - if context.core.playback.tracklist_position != songpos: + if context.core.playback.tracklist_position.get() != songpos: playpos(context, songpos) - context.core.playback.seek(int(seconds) * 1000) + context.core.playback.seek(int(seconds) * 1000).get() @handle_request(r'^seekid "(?P\d+)" "(?P\d+)"$') @@ -343,9 +343,10 @@ def seekid(context, tlid, seconds): Seeks to the position ``TIME`` (in seconds) of song ``SONGID``. """ - if context.core.playback.current_tlid != tlid: + tl_track = context.core.playback.current_tl_track.get() + if not tl_track or tl_track.tlid != tlid: playid(context, tlid) - context.core.playback.seek(int(seconds) * 1000) + context.core.playback.seek(int(seconds) * 1000).get() @handle_request(r'^setvol (?P[-+]*\d+)$') diff --git a/tests/frontends/mpd/protocol/playback_test.py b/tests/frontends/mpd/protocol/playback_test.py index f81be241..9bf467f5 100644 --- a/tests/frontends/mpd/protocol/playback_test.py +++ b/tests/frontends/mpd/protocol/playback_test.py @@ -424,7 +424,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): [Track(uri='dummy:a', length=40000), seek_track]) self.sendRequest('seekid "1" "30"') - self.assertEqual(1, self.core.playback.current_tlid.get()) + self.assertEqual(1, self.core.playback.current_tl_track.get().tlid) self.assertEqual(seek_track, self.core.playback.current_track.get()) self.assertInResponse('OK')