New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPD idle cleanup #1347
MPD idle cleanup #1347
Conversation
47732bf
to
aa010e0
Compare
- Idle events are now emitted on ``seekeded`` events. (Fixes: :issue:`1331`) | ||
|
||
- Event handler for ``playlist_deleted`` has been unbroken. Likely fixes | ||
unreported / diagnosed crashes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"unreported/undiagnosed"
LGTM, with comments :-) |
@@ -57,9 +60,7 @@ def on_stop(self): | |||
process.stop_actors_by_class(session.MpdSession) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm considering the following change to this handling as we don't really ever care about the kwargs
we just need to know what event fired and map it. Thoughts?
_CORE_EVENTS_TO_IDLE_SUBSYSTEMS = {
'track_playback_paused': None,
'track_playback_resumed': None,
'track_playback_started': None,
'track_playback_ended': None,
'playback_state_changed': 'player',
'tracklist_changed': 'playlist',
'playlists_loaded': 'stored_playlist',
'playlist_changed': 'stored_playlist',
'playlist_deleted': 'stored_playlist',
'options_changed': 'options',
'volume_changed': 'mixer',
'mute_changed': 'output',
'seeked': 'player',
'stream_title_changed': 'playlist',
}
....
class MpdFrontend(...):
....
def on_event(self, event, **kwargs):
if event not in _CORE_EVENTS_TO_IDLE_SUBSYSTEMS:
logger.warning(
'Got unexpected event: %s(%s)', event, ', '.join(kwargs))
else:
self.send_idle(_CORE_EVENTS_TO_IDLE_SUBSYSTEMS[event])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably doesn't make sense, reasoning being that we need to add playlists_loaded, playlist_changed, playlist_deleted handling which will update the URI mapper based on changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, and I like that fact that it will complain when we add a new core event and forgets to update MPD.
As for URI mapper maintenance, I'm OK with a if/elif/elif block after the above code.
Comments have been addressed, just my last suggestion / question left now. |
Oh, and the fix for |
Feel free to cherry-pick the |
Done |
This combined with #1346 provides a much nicer experience when seeking as clients are far less likely to end up out of sync.