Mpc clients are slow to connect to git version of mopidy

If I run mopidy from apt-get released version, everything works fine.
If I run ‘mpc next’ then immediately mopidy changes to the next track.

However I am hitting the issue of spotify pausing when there is no internet, so I installed mopidy (and mopidy-spotify and pyspotify) from git version.
Everything is still working find, but now when I run ‘mpc next’ or select a track from any mpc client, there is a long delay (30 seconds) before mopidy changes track.

The mopidy log file shows nothing, until it shows ‘New MPD connection from’ and as soon as that is shown the track is changed.

Any idea why the client takes so long to connect?


Hard to say with the info you’ve posted so far. Have you looked at ?

I did some more digging.
Its only when mopidy-spotify is enabled.

Every mpd command received seems to ask all the extensions for a playlist refresh. This asks mopidy-spotify to refresh its playlists, which I have a lot in my spotify account.
Not sure why it has to refresh playlist on every command.

Mopidy doesn’t refresh the playlists on every MPD command, this must be your client. Which MPD client are you using?

I’m using ‘mpc’ and also python-mpd2 client,and android client… all seem to give same result.

mopidy/ seems to be created for every command request, which creates a new displatcher.MpdDispatcher()

mopidy/ init this init is calling self.refresh_playlists_mapping()

That code does not explicitly refresh the playlists but I think the new 2.0 version of mopidy-spotify always works with fresh data. Which is great when it comes to reflecting playlist changes you make in Spotify’s official/web client but maybe not so great in this case.

I think we left a TODO somewhere in that code about making that mapping a global / caching it higher up. As things stand now it is indeed rather inefficient.

Opened and am happy to merge a PR if someone takes has time to clean this up as I’m still stuck on other tasks :slight_smile:

I have a basic ‘cache all playlist’ bit of code i have added for now.
When I work out how, I will upload a git request to show it.

also just managed to get offline playlists to work from spotify… (this was my big goal), i’ll upload that again when I finish testing and work out how