Musicbox spotify playlists not there?

I found something. Removing and reinstalling the libspotify12 package fixes the problem for me:

apt-get -y remove libspotify12 && apt-get install libspotify12 && service mopidy restart

hope it lasts, so I can create the final version of MusicBox 0.5.1. It’s the way I fixed a strange bug some time ago too…

I commented out the cache_dir setting in the config too.

@woutervanwijk
Thank you very much for the workaround you gave. My Pi Musicbox works like a charm!

Hi all - coming into this discussion a little bit late.

Can anyone confirm that mopidy does work with the spotify premium offline feature? In other words, if I set a playlist/album to be available offline in Spotify - Mopidy will download and play it locally from a cache?

No, not currently but that feature will be available at some point in the future.

Hey folks

This has been consistently hitting me for the past few weeks now, and none of the previous solutions have worked for me (although it did look like maybe there’s an issue with MB0.6.0 where it erroneously sets the spotify cache_dir to “”, which prevents caching from what I could see).

After some digging, I’ve come to the belief that the reason this is an occasional issue is down to this piece of code in mopidy_spotify/session_manager.py:

def log_message(self, session, data):
    """Callback used by pyspotify"""
    logger.debug('System message: %s' % data.strip())
    if 'offline-mgr' in data and 'files unlocked' in data:
        # XXX This is a very very fragile and ugly hack, but we get no
        # proper event when libspotify is done with initial data loading.
        # We delay the expensive refresh of Mopidy's playlists until this
        # message arrives. This way, we avoid doing the refresh once for
        # every playlist or other change. This reduces the time from
        # startup until the Spotify backend is ready from 35s to 12s in one
        # test with clean Spotify cache. In cases with an outdated cache
        # the time improvements should be a lot greater.
        if not self._initial_data_receive_completed:
            self._initial_data_receive_completed = True
            self.refresh_playlists()

...

def refresh_playlists(self):
    """Refresh the playlists in the backend with data from Spotify"""
    if not self._initial_data_receive_completed:
        logger.debug('Still getting data; skipped refresh of playlists')
        return

The issue is that the initial data receive completed flag NEVER seems to be set. As the comment says, this is incredibly fragile, which is likely why this issue randomly appears and disappears!

I’m going to try locally to add a timeout to the logic - after 20s, just assume that the initial data receive has been completed and start returning playlists.

I think there are two things that would help here though -

  1. Make the system more robust (!!)
  2. Change the log message about skipping returning playlists to be INFO level, so it appears in logs by default, as it’s so catastrophic when it goes wrong, and at least that would allow people to diagnose it more easily

…scratch being clever - I just commented out the optimisation (the early return in refresh_playlists) and it’s all fixed for me!

I have a reasonably large set of playlists, several of them being reasonably large, and it only takes a couple seconds to boot up, so I guess I wasn’t gaining much from the optimisation anyway. YMMV!

This is the old version of mopidy-spotify. It doesn’t work like this in the
new version. Musicbox is still stuck with the old version and that’s my
fault. I’ve just not had any time lately.

Yeah, real life sometimes gets in the way :wink:

I had a quick look at the musicbox source on github to see if I could help & make a pull request, but it looks like the barrier to entry is pretty high there - other than add a super filthy text replace line after installing mopidy-spotify I can’t see a way of effecting a change.

Hi- I’ve been unsuccesfully trying to get Pi Musicbox 6 to see Spotify playlists by either adding paths to cache_dir and serttings_dir in settings.ini, or commenting out these lines and deleting cache files. It sounds like you hack of session_manager.py is the next thing to try, however I am unfamiliar with how I would go about this i.e. I have no idea how to find/edit this code. I would be very grateful of dummies how to guide. Thanks!

Man, I’ve been dicking around with PMB 6 all day, no luck in getting the playlist cache to update properly. I know the playlists have been imported, since they’re all sitting in /var/lib/mopidy/spotify/Users/… but for whatever reason it just no worky worky.

Hope we can figure out a solid workaround before the next release.

Hi Robert,

had the same problem, did TheRealMolens trick and now it works like charm.
So if this is still a problem for you here are the steps:

  1. login to to your musicbox by ssh

  2. cd /usr/local/lib/python2.7/dist-packages/mopidy_spotify/
    (if it’s not there on your musicbox you will find it by using “find . -name session_manager.py”)

  3. nano session_manager.py

  4. scroll down to
    " def refresh_playlists(self):
    ""“Refresh the playlists in the backend with data from Spotify”""
    if not self._initial_data_receive_completed:
    logger.debug(‘Still getting data; skipped refresh of playlists’)
    return
    playlists = []
    folders = []

"

  1. make a “#” in the beginning of the line of the “return” that it looks like that:
    def refresh_playlists(self):
    ""“Refresh the playlists in the backend with data from Spotify”""
    if not self._initial_data_receive_completed:
    logger.debug(‘Still getting data; skipped refresh of playlists’)

return

    playlists = []
    folders = []
  1. Press “ctrl+x”

  2. Press “Y”

  3. Press Return

  4. Reboot your musicbox

Best

Yippee - thanks very much :slight_smile:

Its been very difficult and embarrasing to having to listen to my daughters Itunes playlist when outside!

As an Apple Airplay device - the Pi has worked flawlessly but it wouldn’t show up my own Spotify playlists and therefore I couldn’t play MY music via my Note 3 :slight_smile:

One simple commenting out of a line and all is well :slight_smile:

some weeks ago as i set up my musicbox for the first time i could solve the problem, that not even one of my own spotify playlists appeared.

now i forgot, which steps i did to solve the problem, therefore i don’t know, if my actual problem is solved in this thread.

my problem now is, that the spotify playlist that are from spotify itself (like “mix of the week” and so on) don’t appear in the web interface. is there a solution already? thanks!

Certain playlists such as “Discover Weekly” and “Release Radar” are special playlists owned by user Spotify. Unfortunately these playlists can no longer be accessed in clients using libspotify (such as ours) due to incompatible changes Spotify have made in their service. Hopefully we can work around it but for now that is the state of affairs (more info here).

1 Like

So, I’ve had this problem as well and fixed it with the # before return and it solved the problem for a long time.
Now all of a sudden none of the playlists will load. The # is still there and I do not have a cache folder like described.
My playlists page is completely empty.

Anyone any idea how to solve this without me having to reinstall the whole thing?

I wish I could reproduce this issue. But if you are getting it reliably can you please follow the steps outlined at https://github.com/pimusicbox/pimusicbox/issues/400#issuecomment-290943063 to generate a debug log and make it available to look at (http://dpaste.com or something).

1 Like

http://dpaste.com/0K38MA1 Here you go :slight_smile:

First off, Pi Musicbox is brilliant, Thanks so much to the creators. I resurrected a cool old Lasonic ghetto blaster which can now stream Spotify through the auxilliary!

So, I use my iPhone to control the music when I’m in the garden. However, although I can see my custom playlists, the actual tracks don’t load.

I noticed tonight that I can load the tracks in my computer browser no problem. Assuming it is a cache issue, i went to Settings-Safari-Clear History and Website Data and my playlists load! It’s not the best solution, but hopefully this will help someone else out there who controls Pi Musicbox through an iPhone.