Merge branch 'feature/playid-minus-one-should-resume' into develop
This commit is contained in:
commit
3f4c9ca656
@ -43,6 +43,7 @@ No description yet.
|
||||
:issue:`24`, contributes to :issue:`14`)
|
||||
- Improved handling of uncaught exceptions in threads. The entire process
|
||||
should now exit immediately.
|
||||
- MPD command ``playid "-1"`` now correctly resumes playback if paused.
|
||||
|
||||
|
||||
0.1.0 (2010-08-23)
|
||||
|
||||
@ -375,12 +375,15 @@ class BasePlaybackController(object):
|
||||
|
||||
if cp_track is not None:
|
||||
assert cp_track in self.backend.current_playlist.cp_tracks
|
||||
elif not self.current_cp_track:
|
||||
|
||||
if cp_track is None and self.current_cp_track is None:
|
||||
cp_track = self.cp_track_at_next
|
||||
|
||||
if self.state == self.PAUSED and cp_track is None:
|
||||
if cp_track is None and self.state == self.PAUSED:
|
||||
self.resume()
|
||||
elif cp_track is not None:
|
||||
|
||||
if cp_track is not None:
|
||||
self.state = self.STOPPED
|
||||
self.current_cp_track = cp_track
|
||||
self.state = self.PLAYING
|
||||
if not self._play(cp_track[1]):
|
||||
|
||||
@ -138,6 +138,10 @@ def playid(frontend, cpid):
|
||||
at the first track.
|
||||
"""
|
||||
cpid = int(cpid)
|
||||
paused = (frontend.backend.playback.state ==
|
||||
frontend.backend.playback.PAUSED)
|
||||
if cpid == -1 and paused:
|
||||
return frontend.backend.playback.resume()
|
||||
try:
|
||||
if cpid == -1:
|
||||
cp_track = _get_cp_track_for_play_minus_one(frontend)
|
||||
|
||||
@ -285,6 +285,18 @@ class PlaybackControlHandlerTest(unittest.TestCase):
|
||||
self.assertEqual(self.b.playback.STOPPED, self.b.playback.state)
|
||||
self.assertEqual(self.b.playback.current_track, None)
|
||||
|
||||
def test_playid_minus_one_resumes_if_paused(self):
|
||||
self.b.current_playlist.append([Track(length=40000)])
|
||||
self.b.playback.seek(30000)
|
||||
self.assert_(self.b.playback.time_position >= 30000)
|
||||
self.assertEquals(self.b.playback.PLAYING, self.b.playback.state)
|
||||
self.b.playback.pause()
|
||||
self.assertEquals(self.b.playback.PAUSED, self.b.playback.state)
|
||||
result = self.h.handle_request(u'playid "-1"')
|
||||
self.assert_(u'OK' in result)
|
||||
self.assertEqual(self.b.playback.PLAYING, self.b.playback.state)
|
||||
self.assert_(self.b.playback.time_position >= 30000)
|
||||
|
||||
def test_playid_which_does_not_exist(self):
|
||||
self.b.current_playlist.append([Track()])
|
||||
result = self.h.handle_request(u'playid "12345"')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user