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

Fails to play any track, "GStreamer error: Could not get/set settings from/on resource." #388

Open
PureTryOut opened this issue May 22, 2024 · 17 comments
Labels
A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot)

Comments

@PureTryOut
Copy link

Any other extension (like YouTube and SoundCloud) work fine, Mopidy only fails to play Spotify tracks with this cryptic error.

This is using 5.0.0a2

@kingosticks
Copy link
Member

I've had this a couple of times but when I try and track it down, it magically resolves itself after a while. So my current theory is that it's some transient Spotify error, and the error messaging from librespot back to Mopidy is very poor (hoping to improve that). You can try to run with GST_DEBUG=3 to see if there are any hints (https://docs.mopidy.com/stable/troubleshooting/#debugging-gstreamer)

@PureTryOut
Copy link
Author

Ah that helped, suddenly the problem was very obvious 😅

0:06:23.713442473     2 0x7ff4e6218b30 ERROR        spotifyaudiosrc audio/spotify/src/spotifyaudiosrc/imp.rs:238:<gstspotify::spotifyaudiosrc::imp::SpotifyAudioSrc as gstreamer_base::subclass::push_src::PushSrcImpl>::create:<source> failed to start: Login failed with reason: Bad credentials
0:06:23.713585291     2 0x7ff4e6218b30 WARN                 basesrc gstbasesrc.c:3177:gst_base_src_loop:<source> error: Internal data stream error.
0:06:23.713597968     2 0x7ff4e6218b30 WARN                 basesrc gstbasesrc.c:3177:gst_base_src_loop:<source> error: streaming stopped, reason error (-5)
0:06:23.713647658     2 0x7ff4e6218b30 WARN                oggdemux gstoggdemux.c:4775:gst_ogg_demux_send_event:<oggdemux0> error: EOS before finding a chain
0:06:23.713828961     2 0x7ff4e6218b30 WARN                oggdemux gstoggdemux.c:2550:gst_ogg_demux_sink_event:<oggdemux0> EOS while trying to retrieve chain, seeking disabled

It seems my credentials have changed at some point (I know the password, I guess I just forgot that I changed it). I re-authenticated with the new credentials and now it works.

If only the error wasn't so vague 😅 "Login failed with reason: Bad credentials" would be way more useful.

@kingosticks
Copy link
Member

Actually, in this case, I'm not sure why the error doesn't propagate through to Mopidy logging given it's coming through as a gstreamer Error, which we are setup to catch. I'll see if I can get to the bottom of that.

@jaedb
Copy link

jaedb commented Jul 30, 2024

Any luck getting to the bottom of this? I'm experiencing this issue too:

DEBUG    2024-07-30 04:10:38,486 [8:MainThread] mopidy.audio.gst
  Got ERROR bus message: error=GLib.Error('Could not get/set settings from/on resource.', 'gst-resource-error-quark', 13) debug='audio/spotify/src/spotifyaudiosrc/imp.rs(329): <gstspotify::spotifyaudiosrc::imp::SpotifyAudioSrc as gstreamer_base::subclass::push_src::PushSrcImpl>::create (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin3/GstSpotifyAudioSrc:source:\nLogin failed with reason: Bad credentials'

This is with refreshed tokens, reset password, etc.

@PureTryOut
Copy link
Author

I can reproduce this again since yesterday.

@kingosticks
Copy link
Member

There's currently a device and user specific librespot issue. Every implementation is suffering from it. It appears Spotify are rolling out a change to their protocol

@kingosticks
Copy link
Member

See librespot-org/librespot#1308

@kingosticks kingosticks added the A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot) label Aug 13, 2024
@ryanavella
Copy link

ryanavella commented Sep 15, 2024

I was running into #394 and managed to get past that error message with the workaround mentioned in that issue. Now interestingly I'm being blocked on this.

This is after regenerating a credentials.json, regenerating tokens, and verifying it all matches with mopidy.conf.

ERROR    2024-09-15 15:45:55,744 [2243:MainThread] mopidy.audio.gst
  GStreamer error: Could not get/set settings from/on resource.
DEBUG    2024-09-15 15:45:55,744 [2243:MainThread] mopidy.audio.gst
  Got ERROR bus message: error=GLib.Error('Could not get/set settings from/on resource.', 'gst-resource-error-quark', 13) debug='audio/spotify/src/spotifyaudiosrc/imp.rs(239): <gstspotify::spotifyaudiosrc::imp::SpotifyAudioSrc as gstreamer_base::subclass::push_src::PushSrcImpl>::create (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSpotifyAudioSrc:source:\nLogin failed with reason: Bad credentials'

I am wondering if somehow the credentials in mopidy.conf could be taking precedence over my cached credentials.json, and Spotify is just rejecting password-based authentication?

@kingosticks
Copy link
Member

Providing the username in your mopidy.conf matches the username in the credentials.json then the credentials.json takes priority over any supplied password. Some types of Spotify account get unexpected usernames in credentials.json, can you check yours? I need to do another release to make this simpler.

@ryanavella
Copy link

ryanavella commented Sep 15, 2024

My Spotify username is a string of 9 digits, probably auto-generated on their end because I primarily sign in through a Facebook account. It does match in both files, though I have it unquoted in mopidy.conf, not that I think that would matter here.

EDIT: hmm, I'm not sure if this is related, but I'm noticing that I only have a credentials.json living under $HOME/.local/share/mopidy/spotify/credentials-cache/, but I run mopidy as a service through a mopidy user. I need to go digging through the docs to figure out where I should really be placing credentials.json, this doesn't seem like the right location to me... (this is probably not the issue, I copied my credentials.json into the /var/... location mentioned in the other thread with no difference)

Even with GST_DEBUG=3 and -vvvv I don't see credentials.json appear anywhere in the debug output, so I don't have an easy way to verify if the correct credentials are being loaded.

@kingosticks
Copy link
Member

kingosticks commented Sep 16, 2024

GST_DEBUG=3,*spotify:6* should do it

EDIT: or maybe ,*spotify:7* ?

@dnj0104
Copy link

dnj0104 commented Sep 17, 2024

Hello

I also get this error.

I have checked var/lib/ .../ .../ credentials.json and username is the same as in my mopidy config, I have updated client-id and client secret.

and still ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not get/set settings from/on resource

and my credentials.json look like this , of course I removed the auth data and username

{"username":"xyxyxyxyxyxyxyxyxy","auth_type":1,"auth_data":"absbdjsbaab

@ryanavella
Copy link

Wow, I managed to fix it but it was quite a ride. I hacked in a bunch of logging calls throughout mopidy-spotify, which eventually led me here:

self._data_location = Extension().get_data_dir(self.backend._config)
self._config = self.backend._config["spotify"]
self._credentials_dir = self._data_location / "credentials-cache"

This was where I realized that data_dir was not being set to what I wanted it to be. The fix was to make the following change to my mopidy.conf under the [core] section:

-data_dir = $XDG_DATA_DIR/mopidy
+data_dir = /var/lib/mopidy

@kingosticks
Copy link
Member

kingosticks commented Sep 17, 2024

If you're running Mopidy as a service, /var/lib/mopidy is the default data_dir location. There's no need to set things in mopidy.conf if you just want the default. If you're doing something else, but still want to use /var/lib/mopidy for some reason, then OK but that's unusual.

@RoggerFabri
Copy link

Hello

I also get this error.

I have checked var/lib/ .../ .../ credentials.json and username is the same as in my mopidy config, I have updated client-id and client secret.

and still ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not get/set settings from/on resource

and my credentials.json look like this , of course I removed the auth data and username

{"username":"xyxyxyxyxyxyxyxyxy","auth_type":1,"auth_data":"absbdjsbaab

I'm on the same boat, did you manage to fix it?

@dnj0104
Copy link

dnj0104 commented Sep 21, 2024

Hello
I also get this error.
I have checked var/lib/ .../ .../ credentials.json and username is the same as in my mopidy config, I have updated client-id and client secret.
and still ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not get/set settings from/on resource
and my credentials.json look like this , of course I removed the auth data and username
{"username":"xyxyxyxyxyxyxyxyxy","auth_type":1,"auth_data":"absbdjsbaab

I'm on the same boat, did you manage to fix it?

Noo, not yet, I struggling with to obtain a new credentials.json from librespot according to recomended solutions in this thread , but so far no succes .

@kingosticks kingosticks added this to the 5.0 (Replace libspotify) milestone Sep 24, 2024
@kingosticks
Copy link
Member

Mopidy-Spotify v5.0.0a3 and gst-plugin-spotify_0.14.0~alpha.1-1 use access-token login and handle credentials.json for you. Credentials errors should be fixed with these versions. Please run with GStreamer logging enabled (GST_DEBUG=*spot*:6 mopidy) if still seeing issues,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot)
Projects
None yet
Development

No branches or pull requests

6 participants