Spotify loading all playlists makes startup time slow, ~10min


#1

I have a lot of spotify playlists. It seems to me that mopidy has to load all of them each time I start up (I usually shut down my raspberry from time to time), and this means that it takes a long time before the http-server is started. Is this how it has to work? Or is there someting wrong with my install/configuration?

I remebered it being different some time in the past before 1.0. Then the musicbox client was available after less than a minute.

A debug log (shortened), effective config, and deps output is available here: https://goo.gl/nG78Qv
(this is a github-gist, but a direct link wouldn’t work since it created more than two links, which I am not allowed to post as a new user)

I hope someone can shed some light on this.


MPD & HTTP servers take some time to start. Is that normal?
#2

However, the playlist loading isn’t neccesarily finished when the http-server goes up (and GLib mainloop starts) and it can take half an hour before the musicbox interface is usable (i.e. showing playlists, including browsing local files, or working volume control).
Does it have to take this long?


#3

Ok, trying it out on my laptop I have no problems at all. Spotify playlists are loaded in a few seconds and playable via mpd almost immediately.

The big difference is this:
On laptop:

TRACE    2016-03-10 19:18:41,095 [6506:SpotifyBackend-3] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:3Y1ie7QtjWTI0EOkhz4aQ5) took 1ms
TRACE    2016-03-10 19:18:41,096 [6506:SpotifyBackend-3] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:3ajtbH0pXiIiPQBzk3SfZe) took 0ms
TRACE    2016-03-10 19:18:41,099 [6506:SpotifyBackend-3] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:1zcc86TF23W5Xk5ggfEYGz) took 2ms
TRACE    2016-03-10 19:18:41,101 [6506:SpotifyBackend-3] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:5AzPu8P65hjeoSZXcRmxPe) took 1ms
TRACE    2016-03-10 19:18:41,105 [6506:SpotifyBackend-3] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:0TxjFoSnkxDl7opLKcHCK7) took 3ms

On raspberry:

TRACE    2016-03-09 16:01:56,299 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:4j6NwyJW4jAAvRyAFiO6Dp) took 457ms
TRACE    2016-03-09 16:01:57,608 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:07qohL3uoC3QGuFMM6qyiy) took 1300ms
TRACE    2016-03-09 16:01:59,440 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:6POa0xvUNY6bCMoH9ql1b2) took 1824ms
TRACE    2016-03-09 16:02:03,262 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:3xQBmAatjLiDbGKtwR7Q5z) took 3813ms
TRACE    2016-03-09 16:02:03,547 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:0GOjPt7faKg5qEVNZwh9nD) took 276ms
TRACE    2016-03-09 16:02:04,105 [32654:SpotifyBackend-8] mopidy_spotify.utils
  playlists.lookup(spotify:user:andersochstina:playlist:5mxoxEmznKmQJfI8i2BGa7) took 551ms

Could all this amount to the raspberry’s limited processing power or other limiting hardware factors? I will have to check my setup more carefully.


#4

I’m experiencing a similar Problem, did you find out more about it?


#5

I have tried with a clean install of raspbian and mopidy, but it is still too slow. Now I can’t seem to get it working at all, waiting many hours. Should say that it’s a Raspberry Pi 1 model B revision 2. I think the card is SDHC class 10.

The strange thing is that this was not a problem before (with some earlier versions of mopidy, libspotify, etc…)


#6

I’m using a Raspberry Pi 2, so ist should not just be a Pi 1/B Problem.

The long boot time was also not a Problem for me the first couple of starts of mopidy…


#7

New to mopidy, id discover this problem on my installation, so i found also this discution… any news about it ?


#8

Same problem here. Using mopidy on a Raspberry Pi Zero. Startup time without the spotify extension is fine. But with it enabled, it goes up to about 5 minutes, which is really annoying during the initial setup process. Also the force cache option didn’t do anything for me.


#9

I was hoping that somebody had a solution for this. I’ve installed mopidy on a fresh install with a Hifiberry mini and a Usb ethernet dongle… Without spotify it takes just a minute or so when mopidy starts to autoplay a track. But with spotify enabled it takes about 20 minutes before mopidy starts to play anything. Even mpc has to wait for 25 minutes before I can do anything.

First I was thinking about a memory issue. But this should be sufficient.

          total        used        free      shared  buff/cache   available

Mem: 465 83 51 3 330 325
Swap: 99 0 99

Hopefully someone can help. It would be okay if mopidy would just start and do spotify scanning in the background.


#10

I’m a bit confused, is this latest mopidy? I ask because there is no “autoplay” functionality so this doesn’t meant make sense.


#11

Thank you for your quick reply. If installed the latest of mopidy and raspbian. With autoplay I mean the restore state option, which by the way I really like.

[core]
restore_state = false

I’m using a Pi Zero with a Transcend 16GB sd card. Which is one that should work perfectly with the Pi.


#12

Ahhh OK. Can you get a full debug log (run with -vvv) to see what it’s doing during the startup phase? I’m guessing you might see a lot of metadata update messages, particularly if you have lots of playlists.


#13

I’ll do it right away tomorrow morning. I really appreciate your help.


#14

I didn’t have time to the debug log. But I’ve replaced the USB dongle with another one. I Guess that the older one, wasn’t a 100 mbit one as stated on aliexpress. With the new one the loading of spotify playlists goes a bit faster. Only 5 minutes on my Pi Zero. Which takes only half a minute on a pi 3. The 5 minutes is okay with me.

It would however be very nice of initializing the Spotify playlist could take place in the background, so that I can use mopiyd for my local mp3 files until the playlists are fully loaded.

edited: I’ve also discovered that I have a slow sd card 400x and ordered a 600x speed. Hope it helps. Will keep you informed.