orontee / argos

Light weight front-end for Mopidy music server
GNU General Public License v3.0
24 stars 4 forks source link

Spotify playlists not loading #177

Closed MaxCreeger32 closed 2 months ago

MaxCreeger32 commented 5 months ago

Hello,

I really love this software that I discovered last week. Thank you for this job ! I have noticed that loading spotify playlists never finish loading titles, in the playlists tab. The waiting wheel with the message "Loading playlist tracks..." stay all along the time and the tracks are never displayed. when I look at the debug log I only see this :

2024-06-26 22:08:23,906 EventLoopThread DEBUG: argos.message - Dispatching message of type MessageType.COMPLETE_PLAYLIST_DESCRIPTION
2024-06-26 22:08:23,906 EventLoopThread DEBUG: argos.controllers.playlists - Processing message of type MessageType.COMPLETE_PLAYLIST_DESCRIPTION
2024-06-26 22:08:23,907 EventLoopThread DEBUG: argos.controllers.playlists - Completing description of playlist with URI 'spotify:playlist:7cps72Rh2XaW4s7BkEmW9Q'
2024-06-26 22:08:23,908 EventLoopThread DEBUG: argos.ws - Sending JSON-RPC command 17 with method core.playlists.lookup
2024-06-26 22:08:24,320 EventLoopThread DEBUG: argos.ws - Received result of JSON-RPC command 17

the message is well received by argos

and If i Look in the mopidy journal :

mopidy_spotify.utils playlists.lookup('spotify:playlist:7cps72Rh2XaW4s7BkEmW9Q') took 383ms
Jun 26 22:08:26 spotiplay mopidy[662]: DEBUG    [HttpServer] mopidy.http.handlers Sent WebSocket message to 192.XXX.XXX.XXX: '{"jsonrpc": "2.0", "id": 17, "result": {"__model__": "Playlist", "uri": "spotify:playlist:7cps72Rh2XaW4s7BkEmW9Q", ...........

so the message sent seems ok and is received by Argos. I tried to watch the code but I did not see (because I am not used to python and GTK) where is the problem.

Can you please give me some tips to understand how to make debug the app , and which tools do you use to create it.

Another thing : I do not manage to see the configuration items of Argos (which is installed via flatpak on WSL under Win11). image

even in Gsettings

$ gsettings list-children io.github.orontee.Argos
No such schema “io.github.orontee.Argos”

Thank you for your help.

orontee commented 5 months ago

First thank you very much for your feedbacks!

Sorry to hear about this playlist problem. I don't have a Spotify account so I never checked myself and I can't remember users validating that it works correctly... But the beauty of Mopidy is that it should abstract all those APIs, so "remontons-nous les manches"!

Can you please give me some tips to understand how to make debug the app , and which tools do you use to create it.

First, you should post more information:

Second, if you want to debug by yourself, you'll find some tips in the "debugging" section of the contributing guide. But it's rather rough tooling that's suggested there: pdb is a command line debugger.

So for a Python starter (welcome onboard!) the simplest thing to do is to find a recent Linux box, install Builder, click "Add a project", enter the Github URL of Argos, click the run button and... that's all! All dependencies installed magically, interactive debug, etc. :warning: Disclaimer, I never tried on a Windows box.

Otherwise you can use your preferred editor, learn to build the application (explained in that guide too). Then add temporary logs to the standard output: All modules have a LOGGER global variable you can use to print stuff...

Read https://github.com/orontee/argos/blob/main/argos/controllers/playlists.py#L180 and the private function it calls https://github.com/orontee/argos/blob/main/argos/controllers/playlists.py#L200.

About your second question:

When using Flatpak, you should think "containers" or "sandbox". So to access the GSettings of the application running in the sandbox, first enter the sandbox.

For example, on a computer where Argos is installed as a DEB package for daily use and as Flatpak to develop (peitho is a Linux box):

matthias@peitho:~/Projets/argos$ gsettings get io.github.orontee.Argos mopidy-base-url
'http://192.168.1.45'
matthias@peitho:~/Projets/argos$ flatpak run --devel --command=sh io.github.orontee.Argos
[📦 io.github.orontee.Argos ~]$ gsettings get io.github.orontee.Argos mopidy-base-url
'http://localhost:6680'
[📦 io.github.orontee.Argos ~]$ exit
exit
matthias@peitho:~/Projets/argos$ 

Note I didn't checked on a Windows box but I don't expect things to be that different!

Please keep me informed of your progress.

orontee commented 5 months ago

@MaxCreeger32 Oh, I forgot to ask a trivial question: Do Spotify playlists appear in other Mopidy clients? Say Iris?

orontee commented 5 months ago

Arff looks like one needs a Premium account to play with Spotify from Mopidy. I'll try to help but I can't debug on my side.

MaxCreeger32 commented 5 months ago

@MaxCreeger32 Oh, I forgot to ask a trivial question: Do Spotify playlists appear in other Mopidy clients? Say Iris?

Oh yes I forgot to say that too, yes with Iris the playlist appears ! that's how I do to load the playlist, I go first on Iris to load the playlist, play the first song and after all is controlled by Argos.

Thanks for your debugging tips, I will try to do this and with my premium account , I am pretty sure that we will manage to fix it.

A complete log if possible (Completing a playlist description calls the JSON-RPC command core.playlists.lookup , one sees that it was the 17-th sent commands but what happens next from the log point of view?? There should be a log starting with "Fetching tracks of playlist with URI..." followed by a sequence of core.library.lookup JSON-RPC commands)

Unfortunately , nothing more happens...

kingosticks commented 5 months ago

Does the Mopidy debug log show a response to the playlist lookup? Do you have the latest pre-release version instealled?

orontee commented 4 months ago

@MaxCreeger32 Any progress? Could I help?

orontee commented 2 months ago

According to what @MaxCreeger32 posted in private message Spotify playlist don't have the last_modified attribute populated. Mopidy's documentation is clear with that: last_modified can be None but Argos doesn't support that because of a hack based on that attribute (if I remember correctly, last_modified being equal to -1 on the model means that the tracks details haven't been loaded: The playlist is partially known).

See this explicit test: https://github.com/orontee/argos/blob/main/tests/test_dto.py#L61.

@MaxCreeger32 I'll provide a fix but give me some time since removing that hack without regression may happen to be not trivial :slightly_smiling_face:

orontee commented 2 months ago

@MaxCreeger32 A fix for the last_modified property of playlists has landed on main branch.

Let me know whether Spotify playlists now load, and feel free to post here in case there're still problems...

MaxCreeger32 commented 2 months ago

Yes I will tell you here. A the moment there is an issue with the login api of Spotify in librespot that is used for mopidy-spotify extension : https://github.com/librespot-org/librespot/issues/1308#issuecomment-2258478905 the workaround is here : https://github.com/mopidy/mopidy-spotify/issues/394#issuecomment-2285831264 I am trying use this workaround but i have to be very patient as rust needs a lot of RAM ... and I am running it on Rpi zero 2