Fix 'song: None' in 'status' response
This commit is contained in:
parent
ba738b5c1e
commit
342c13f811
@ -58,6 +58,9 @@ No description yet.
|
||||
resume and addition of tracks to the current playlist while playing for the
|
||||
MPoD client.
|
||||
|
||||
- Fix bug where ``status`` returned ``song: None``, which caused MPDroid to
|
||||
crash. (Fixes: :issue:`69`)
|
||||
|
||||
- Settings:
|
||||
|
||||
- Fix crash on ``--list-settings`` on clean installation. Thanks to Martins
|
||||
|
||||
@ -246,7 +246,7 @@ class PlaybackController(object):
|
||||
if self.repeat or self.consume or self.random:
|
||||
return self.current_cp_track
|
||||
|
||||
if self.current_cp_track is None or self.current_playlist_position == 0:
|
||||
if self.current_playlist_position in (None, 0):
|
||||
return None
|
||||
|
||||
return self.backend.current_playlist.cp_tracks[
|
||||
@ -452,11 +452,10 @@ class PlaybackController(object):
|
||||
stopping
|
||||
:type clear_current_track: boolean
|
||||
"""
|
||||
if self.state == self.STOPPED:
|
||||
return
|
||||
self._trigger_stopped_playing_event()
|
||||
if self.provider.stop():
|
||||
self.state = self.STOPPED
|
||||
if self.state != self.STOPPED:
|
||||
self._trigger_stopped_playing_event()
|
||||
if self.provider.stop():
|
||||
self.state = self.STOPPED
|
||||
if clear_current_track:
|
||||
self.current_cp_track = None
|
||||
|
||||
|
||||
@ -123,3 +123,36 @@ class IssueGH22RegressionTest(unittest.TestCase):
|
||||
self.mpd.handle_request(u'deleteid "5"')
|
||||
self.mpd.handle_request(u'deleteid "6"')
|
||||
self.mpd.handle_request(u'status')
|
||||
|
||||
|
||||
class IssueGH69RegressionTest(unittest.TestCase):
|
||||
"""
|
||||
The issue: https://github.com/mopidy/mopidy/issues#issue/69
|
||||
|
||||
How to reproduce:
|
||||
|
||||
Play track, stop, clear current playlist, load a new playlist, status.
|
||||
|
||||
The status response now contains "song: None".
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.backend = DummyBackend.start().proxy()
|
||||
self.backend.current_playlist.append([
|
||||
Track(uri='a'), Track(uri='b'), Track(uri='c'),
|
||||
Track(uri='d'), Track(uri='e'), Track(uri='f')])
|
||||
self.backend.stored_playlists.create('foo')
|
||||
self.mixer = DummyMixer.start().proxy()
|
||||
self.mpd = dispatcher.MpdDispatcher()
|
||||
|
||||
def tearDown(self):
|
||||
self.backend.stop().get()
|
||||
self.mixer.stop().get()
|
||||
|
||||
def test(self):
|
||||
self.mpd.handle_request(u'play')
|
||||
self.mpd.handle_request(u'stop')
|
||||
self.mpd.handle_request(u'clear')
|
||||
self.mpd.handle_request(u'load "foo"')
|
||||
response = self.mpd.handle_request(u'status')
|
||||
self.assert_('song: None' not in response)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user