DavisNT / mopidy-alarmclock

A Mopidy extension for using it as an alarm clock.
https://pypi.org/project/Mopidy-AlarmClock/
Apache License 2.0
40 stars 14 forks source link

Cannot see spotify playlists #12

Closed ettom closed 4 years ago

ettom commented 6 years ago

After creating a local playlist, I can't see spotify playlists any more. Only local playlists show up. Running Mopidy 2.1.0 and Mopidy-Alarmclock 0.1.7, using Iris as a frontend. Spotify playlists play fine through Iris.

Tried clearing ~/.cache/mopidy and reinstalling Mopidy-Alarmclock.

DavisNT commented 6 years ago

Most likely this has nothing to do with creation of local playlists. This is caused by underlying issue in Mopidy-Spotify and affects Mopidy in general (not only Mopidy-AlarmClock).

ettom commented 6 years ago

If this was the same issue, I wouldnt be able to see spotify playlists in Iris, no? I tried the fix posted in your reference and it didn't solve my problem, yet it seemed to work for others. Maybe it isn't the same issue?

blacklight commented 6 years ago

@ettom the symptoms (Spotify playlists no longer visible in mopidy) point to the same root cause (Spotify dropping user playlists support in libspotify), so I guess the issue you're facing is the same.

Cloning my fork of mopidy-spotify should fix it, provided that:

Note that the fix will make mopidy startup a bit slower though, as it has to download all the tracks in all the playlists through the web API.

Also, once the fix gets pushed upstream, please remember to uninstall my branch and install the new official mopidy-spotify package.

ettom commented 6 years ago

As I already pointed out, I have no problem playing and viewing Spotify playlists through the Mopidy-Iris web interface. I installed your branch correctly and it did not solve the problem.

blacklight commented 6 years ago

Can you post the output of mopidy -vvvv?

ettom commented 6 years ago

https://pastebin.com/vMuPJ63s

blacklight commented 6 years ago

The logs show that no Spotify playlists have been loaded:

DEBUG    2018-05-28 15:47:39,544 [30482:SpotifyEventLoop] spotify.playlist_container
  Playlist container loaded
DEBUG    2018-05-28 15:47:39,545 [30482:SpotifyEventLoop] mopidy_spotify.playlists
  Spotify playlist container loaded
DEBUG    2018-05-28 15:47:39,545 [30482:SpotifyEventLoop] mopidy.listener
  Sending playlists_loaded to BackendListener: {}

Note that no playlist are being sent to the BackendListener.

The reason is that mopidy-spotify is currently broken because libspotify no longer allows access to user-created playlists unless the web API is used.

Can you try to install my branch and post the output of mopidy -vvvv again?

ettom commented 6 years ago

Ok, I uninstalled mopidy-spotify and deleted all files related to it. I then ran mopidy -vvvv , and confirmed that mopidy-spotify is indeed uninstalled. DEBUG 2018-05-28 18:08:39,174 [20494:MainThread] mopidy.ext 18 Discovered extensions: mpd, http, stream, m3u, softwaremixer, file, local, somafm, youtube, local-images, iris, alarmclock

I then did

git clone git@github.com:BlackLight/mopidy-spotify.git
cd mopidy-spotify
git checkout -b fix/incompatible_playlists
sudo python2 setup.py build install

Here is the output of the last command. https://pastebin.com/VP5mqiu2 And here is the output of mopidy -vvvv https://pastebin.com/CdJmKmDq No playlists loaded.

blacklight commented 6 years ago

You probably have mopidy-spotify installed somewhere else, and mopidy is still using that installation.

There are several ERROR traces in the current branch (to test if the playlists retrieval works properly), and I can't see those traces in your mopidy log.

I see that setup.py installed mopidy-spotify under /usr/local/lib/python2.7/dist-packages, are you sure that no other mopidy-spotify installation (or *.dist-info directories) are present anywhere else - e.g. under /usr/lib/python2.7/[site|dist]-packages or /usr/local/lib/python2.7/[site|dist]-packages?

ettom commented 6 years ago

I couldn't find any other Mopidy-Spotify installation. Checked all of these directories and tried reinstalling multiple times. I originally installed Mopidy-Spotify through apt, is there any other place an old installation could be?

There is another problem that occurred after I tried reinstalling Mopidy, maybe it's related. I get this error, when running mopidy -vvvv as a non-root user. Running as root or as a service works fine.

INFO     2018-05-28 20:37:04,382 [11637:MainThread] mopidy.commands
  Starting Mopidy backends: SomaFMBackend, SpotifyBackend, StreamBackend, M3UBackend, FileBackend, LocalBackend
DEBUG    2018-05-28 20:37:04,383 [11637:MainThread] pykka
  Registered SomaFMBackend (urn:uuid:7e35674e-ffcd-4732-93a7-1c1d526d8ee9)
DEBUG    2018-05-28 20:37:04,383 [11637:MainThread] pykka
  Starting SomaFMBackend (urn:uuid:7e35674e-ffcd-4732-93a7-1c1d526d8ee9)
TRACE    2018-05-28 20:37:04,387 [11637:MainThread] mopidy.internal.timer
  SomaFMBackend took 5ms
DEBUG    2018-05-28 20:37:04,391 [11637:MainThread] pykka
  Registered SpotifyBackend (urn:uuid:e782a72b-7900-4d4b-9755-f6aced55aacf)
DEBUG    2018-05-28 20:37:04,392 [11637:MainThread] pykka
  Starting SpotifyBackend (urn:uuid:e782a72b-7900-4d4b-9755-f6aced55aacf)
DEBUG    2018-05-28 20:37:04,393 [11637:SomaFMBackend-3] urllib3.connectionpool
  Starting new HTTPS connection (1): api.somafm.com
TRACE    2018-05-28 20:37:04,398 [11637:MainThread] mopidy.internal.timer
  SpotifyBackend took 7ms
Segmentation fault (core dumped)
DavisNT commented 6 years ago

Iris readme states that it is "Integrated with Spotify and LastFM APIs for high-quality artwork and extra info". According to this I assume that Iris already uses playlist info (via Spotify web APIs) directly from Spotify (bypassing Mopidy-Spotify). @ettom most likely would fail to see Spotify playlists in any generic web frontend (like MusicBox-Webclient, Moped or Simple-Webclient).

ettom commented 6 years ago

Yes, I can't see any playlists with Simple-Webclient.

DavisNT commented 6 years ago

@ettom This confirms that your case is caused by the underlying issue in Mopidy-Spotify. I hope this will soon be fixed in Mopidy-Spotify! As a temporary workaround maybe it is possible to load a Spotify playlist in Iris and then save it as Mopidy local playlist?

ettom commented 6 years ago

Okay, I can now see the playlists. I'm not quite sure what I did right this time, but I think I was building the mopidy-spotify/develop branch all this time. For some reason removing the -b flag from git checkout -b fix/incompatible_playlists did the trick.

Thanks for your help!

midnightmastermind commented 6 years ago

So checking out your incompatible_playlists worked in grabbing the references to the playlists but the API to actually grab the playlist and tracks gets a "200 None" return status and the playlists don't show up in ncmpcpp. Any idea what could be going wrong?

nach40 commented 4 years ago

Cannot see Spotify playlists I have successfully played the songs with Iris But how to set up the playlist so to be able to see it in the dropdown in the alarm. The alarm is working, I mean the alarm is activated at the right time. But only alarm buzzer. Also when I submit the form with no added playlist returned error 500

DavisNT commented 4 years ago

This is fixed in Mopidy 3 for Python 3. I will need to check whether Mopidy-AlarmClock works on Mopidy 3 for Python 3 (and fix it if needed).

nach40 commented 4 years ago

Thanks, I have installed Mopidy3, but Iris is not appearing, alarm-clock also :(. When you will able(expect) to migrate to Python3.7?

DavisNT commented 4 years ago

Mopidy-AlarmClock has been updated for Mopidy 3 and Python 3. Spotify playlists are visible and usable now.