Catching music stop events both on track_playback_ended and playback_state_changed

This commit is contained in:
Fabio Manganiello 2019-02-13 00:58:40 +01:00
parent 8a9c868f77
commit 34e2dffe99

View file

@ -133,7 +133,9 @@ class MusicMopidyBackend(Backend):
if not track:
return
self.bus.post(MusicPlayEvent(status=status, track=track))
elif event == 'track_playback_ended':
elif event == 'track_playback_ended' or (
event == 'playback_state_changed'
and msg.get('new_state') == 'stopped'):
status['state'] = 'stop'
track = self._parse_track(track)
if not track: