Skip to content
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

Merged
merged 10 commits into from Dec 5, 2015
Merged

MPD idle cleanup #1347

merged 10 commits into from Dec 5, 2015

Conversation

adamcik
Copy link
Member

@adamcik adamcik commented Dec 4, 2015

This combined with #1346 provides a much nicer experience when seeking as clients are far less likely to end up out of sync.

@adamcik adamcik added the MPD label Dec 4, 2015
@adamcik adamcik added this to the v1.2 - Gapless milestone Dec 4, 2015
@jodal jodal changed the title MPD idle clenaup MPD idle cleanup Dec 4, 2015
- Idle events are now emitted on ``seekeded`` events. (Fixes: :issue:`1331`)

- Event handler for ``playlist_deleted`` has been unbroken. Likely fixes
unreported / diagnosed crashes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"unreported/undiagnosed"

@jodal
Copy link
Member

jodal commented Dec 4, 2015

LGTM, with comments :-)

@jodal jodal self-assigned this Dec 4, 2015
@@ -57,9 +60,7 @@ def on_stop(self):
process.stop_actors_by_class(session.MpdSession)

Copy link
Member Author

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]) 

Copy link
Member Author

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.

Copy link
Member

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.

@adamcik
Copy link
Member Author

adamcik commented Dec 5, 2015

Comments have been addressed, just my last suggestion / question left now.

@adamcik
Copy link
Member Author

adamcik commented Dec 5, 2015

Oh, and the fix for playlist_deleted could probably be backported to a bugfix release if we want to.

@jodal
Copy link
Member

jodal commented Dec 5, 2015

Feel free to cherry-pick the playlists_deleted commit to the release-1.1 branch. I'd like to make an 1.1.2 release soon.

@adamcik
Copy link
Member Author

adamcik commented Dec 5, 2015

Done

jodal added a commit that referenced this pull request Dec 5, 2015
@jodal jodal merged commit 3e259f1 into mopidy:develop Dec 5, 2015
@adamcik adamcik deleted the feature/mpd-idle-cleanup branch December 5, 2015 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants