Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotify playlists not loading #177

Closed
MaxCreeger32 opened this issue Jun 26, 2024 · 9 comments
Closed

Spotify playlists not loading #177

MaxCreeger32 opened this issue Jun 26, 2024 · 9 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@MaxCreeger32
Copy link

MaxCreeger32 commented Jun 26, 2024

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 orontee added the bug Something isn't working label Jun 26, 2024
@orontee orontee self-assigned this Jun 26, 2024
@orontee
Copy link
Owner

orontee commented Jun 26, 2024

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:

  • 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)
  • The JSON object received by 17-th command (Attach a file if the object is too big and see me a private message if you're concerned about possible secrets or private data, I won't keep the file) and the related following commands

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. ⚠️ 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
Copy link
Owner

orontee commented Jun 26, 2024

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

@orontee
Copy link
Owner

orontee commented Jun 26, 2024

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.

@orontee orontee added this to the Next release milestone Jun 26, 2024
@orontee orontee changed the title spotify playlists not loading Spotify playlists not loading Jun 26, 2024
@MaxCreeger32
Copy link
Author

@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
Copy link

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

@orontee orontee modified the milestones: Summer release, Next release Jul 22, 2024
@orontee
Copy link
Owner

orontee commented Jul 26, 2024

@MaxCreeger32 Any progress? Could I help?

@orontee
Copy link
Owner

orontee commented Sep 8, 2024

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 🙂

orontee added a commit that referenced this issue Sep 14, 2024
orontee added a commit that referenced this issue Sep 14, 2024
@orontee
Copy link
Owner

orontee commented Sep 14, 2024

@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...

@orontee orontee closed this as completed Sep 14, 2024
@MaxCreeger32
Copy link
Author

MaxCreeger32 commented Sep 16, 2024

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 : librespot-org/librespot#1308 (comment)
the workaround is here : mopidy/mopidy-spotify#394 (comment)
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants