core: Remove playback.current_tlid
This commit is contained in:
parent
2f27167677
commit
d107b13fcb
@ -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.
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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<tlid>\d+)" "(?P<seconds>\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<volume>[-+]*\d+)$')
|
||||
|
||||
@ -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')
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user