Skip to content

Commit

Permalink
Do not send {started,stopped}_playing events without track data (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jodal committed Oct 1, 2010
1 parent fca321f commit d86ffe7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions mopidy/backends/base/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,12 @@ def _trigger_started_playing_event(self):
For internal use only. Should be called by the backend directly after a
track has started playing.
"""
self.backend.core_queue.put({
'to': 'frontend',
'command': 'started_playing',
'track': self.current_track,
})
if self.current_track is not None:
self.backend.core_queue.put({
'to': 'frontend',
'command': 'started_playing',
'track': self.current_track,
})

def _trigger_stopped_playing_event(self):
"""
Expand All @@ -515,9 +516,10 @@ def _trigger_stopped_playing_event(self):
is stopped playing, e.g. at the next, previous, and stop actions and at
end-of-track.
"""
self.backend.core_queue.put({
'to': 'frontend',
'command': 'stopped_playing',
'track': self.current_track,
'stop_position': self.time_position,
})
if self.current_track is not None:
self.backend.core_queue.put({
'to': 'frontend',
'command': 'stopped_playing',
'track': self.current_track,
'stop_position': self.time_position,
})

0 comments on commit d86ffe7

Please sign in to comment.