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 changed authentication - Can't play content: GStreamer error: Could not get/set settings from/on resource #2429

Open
The-Judge opened this issue Sep 18, 2024 · 9 comments · May be fixed by #2435
Labels
bug ext dependency legacy_v2 Issues, discussions and PRs related to Version 2.x spotify edition

Comments

@The-Judge
Copy link

The-Judge commented Sep 18, 2024

Version

2.7.0 - 550a258 - master

Branch

master

OS

Raspbian GNU/Linux 11 (bullseye) - Lite 32Bit

Pi model

3 B Rev 1.2

Hardware

  • Raspberry Pi 3B
  • HifiBerry DAC+

What happened?

Installing Phoniebox works fine. When the box boots up, I can hear the boot-sound from the speakers fine also.
But when I play Spotify content via the WebUI or Iris, nothing plays and the following is written to the mopidy log:

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

Logs

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

Configuration

mpd.conf

music_directory		"/home/pi/RPi-Jukebox-RFID/shared/audiofolders"
playlist_directory		"/home/pi/RPi-Jukebox-RFID/playlists"
db_file			"/var/lib/mpd/tag_cache"
log_file			"syslog"
pid_file			"/run/mpd/pid"
state_file			"/var/lib/mpd/state"
sticker_file                   "/var/lib/mpd/sticker.sql"
user				"root"
bind_to_address		"localhost"
log_level			"default"
auto_update    "yes"
auto_update_depth "10"
input {
        plugin "curl"
}
input {
        enabled    "no"
        plugin     "qobuz"
}
input {
        enabled      "no"
        plugin       "tidal"
}
decoder {
        plugin                  "hybrid_dsd"
        enabled                 "no"
}
audio_output {
	type		"alsa"
	name		"My ALSA Device"
	mixer_control	"DSP Program"		# optional
}
volume_normalization		"yes"
filesystem_charset		"UTF-8"

/etc/mopidy/mopidy.conf

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume = 30
output = alsasink
buffer_time =

[proxy]
scheme =
hostname =
port =
username =
password =

[file]
enabled = true
media_dirs =
  $XDG_MUSIC_DIR|Music
  ~/|Home
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir =
default_encoding = UTF-8
default_extension = .m3u
playlists_dir = /home/pi/RPi-Jukebox-RFID/playlists

[softwaremixer]
enabled = true

[stream]
enabled = true
protocols =
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist =
timeout = 5000

[iris]
enabled = true
country = DE
locale = de_DE
verify_certificates = true
snapcast_enabled = true
snapcast_host = localhost
snapcast_port = 1780
snapcast_ssl = false
snapcast_stream = Default
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
data_dir = $XDG_DATA_DIR/iris

[local]
enabled = true
max_search_results = 100
media_dir = /home/pi/RPi-Jukebox-RFID/shared/audiofolders
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
included_file_extensions =
excluded_file_extensions =
  .conf
  .jpg
  .txt
  placeholder
directories =
  Albums                  local:directory?type=album
  Artists                 local:directory?type=artist
  Composers               local:directory?type=artist&role=composer
  Genres                  local:directory?type=genre
  Performers              local:directory?type=artist&role=performer
  Release Years           local:directory?type=date&format=%25Y
  Tracks                  local:directory?type=track
  Last Week's Updates     local:directory?max-age=604800
  Last Month's Updates    local:directory?max-age=2592000
timeout = 10
use_artist_sortname = false
album_art_files =
  *.jpg
  *.jpeg
  *.png

[mpd]
enabled = true
hostname = 0.0.0.0
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
  listall
  listallinfo
default_playlist_scheme = m3u

[spotify]
enabled = true
username = <REMOVED>
password = ********
client_id = c9c9350b-<REMOVED>
client_secret = ********
bitrate = 160
volume_normalization = true
timeout = 10
allow_cache = true
cache_size = 8192
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50

More info

Running the following as root and user mopidy works fine:

gst-launch-1.0 playbin uri=file:///usr/share/sounds/alsa/Front_Center.wav
@The-Judge The-Judge added bug legacy_v2 Issues, discussions and PRs related to Version 2.x needs triage labels Sep 18, 2024
@harrydoddnoble
Copy link

I ma having the same issue - not sure if it's related to this?

@s-martin
Copy link
Collaborator

s-martin commented Sep 18, 2024

Yes, the problem is probably that Spotify requires now oauth authentication.

This has to be fixed in mopidy-spotify, see also mopidy/mopidy-spotify#394

@s-martin s-martin changed the title 🐛 | Can't play content: GStreamer error: Could not get/set settings from/on resource 🐛 | Spotify changed authentication - Can't play content: GStreamer error: Could not get/set settings from/on resource Sep 18, 2024
@s-martin s-martin pinned this issue Sep 18, 2024
@s-martin s-martin linked a pull request Oct 7, 2024 that will close this issue
@s-martin
Copy link
Collaborator

s-martin commented Oct 7, 2024

All

PR #2435 updates mopidy-spotify, which should fix this issue.

Everyone is invited to test this fix.

@seschu
Copy link

seschu commented Oct 13, 2024

Hi there I have the same problem I think. i am confused a little bit: How do I get the credentials.json mentioned in the fix?

@s-martin
Copy link
Collaborator

s-martin commented Oct 13, 2024

@seschu

The PR #2435 is supposed to fix this, please check it out

@seschu
Copy link

seschu commented Oct 13, 2024

@seschu

The PR #2435 is supposed to fix this, please check it out

I did update the spotify mopidy version but now I am getting this error

"
Oct 13 20:57:52 theobox mopidy[6044]: INFO [MpdSession-38] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:47336
Oct 13 20:57:52 theobox mopidy[6044]: INFO [MpdSession-39] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:47340
Oct 13 20:57:52 theobox mopidy[6044]: INFO [MpdSession-40] mopidy_mpd.session New MPD connection from [::ffff:127.0.0.1]:47346
Oct 13 20:57:52 theobox mopidy[6044]: Traceback (most recent call last):
Oct 13 20:57:52 theobox mopidy[6044]: File "/usr/local/lib/python3.9/dist-packages/mopidy/audio/actor.py", line 577, in _on_source_setup
Oct 13 20:57:52 theobox mopidy[6044]: self._source_setup_callback(source)
Oct 13 20:57:52 theobox mopidy[6044]: File "/usr/local/lib/python3.9/dist-packages/mopidy_spotify/backend.py", line 50, in on_source_setup
Oct 13 20:57:52 theobox mopidy[6044]: source.set_property("access-token", self.backend._web_client.token())
Oct 13 20:57:52 theobox mopidy[6044]: TypeError: object of type GstSpotifyAudioSrc' does not have property access-token'
Oct 13 20:57:52 theobox mopidy[6044]: ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not get/set settings from/on resource.

"

@s-martin
Copy link
Collaborator

Probably not completely fixed

mopidy/mopidy-spotify#394 (comment)

@seschu
Copy link

seschu commented Oct 13, 2024

I think we have to get the credentials.json file from librespot mopidy/mopidy-spotify#394

@seschu
Copy link

seschu commented Oct 13, 2024

I made it work by doing the following:

  1. I had to generate a new request token directly at Spotify
    https://developer.spotify.com/documentation/web-playback-sdk/tutorials/getting-started

  2. I updated the mopidy client id and secret (I actually don't know if this is necessary) under /etc/mopidy/mopidy.conf

  3. The new request token from step 1 is used for creating a file called credentials.json. I placed this file with sudo cp in this location /var/lib/mopidy/spotify/credentials-cache/credentials.json
    The file has this content
    {"username":"weirdusername",
    "auth_type":1,"auth_data":"generatedaccesstoken"}
    generatedaccesstoken is the token received from the spotify website in step 1.
    the username is a weird random combination of letters that I see when I check my spotify profile page (on desktop in browser or in a desktop app) and press edit profile.

  4. I then updated the gstreamerplugin with this alpha release https://github.com/kingosticks/gst-plugins-rs-build/releases/tag/gst-plugin-spotify_0.14.0-alpha.1-1
    Here I only downlaoded this file https://github.com/kingosticks/gst-plugins-rs-build/releases/download/gst-plugin-spotify_0.14.0-alpha.1-1/gst-plugin-spotify_0.14.0.alpha.1-1_armhf.deb
    and I installed it doing
    sudo apt remove gst-plugin-spotify
    sudo dpkg -i gst-plugin-spotify_0.14.0.alpha.1-1_armhf.deb

I am not sure whether all steps were necessary. It works currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ext dependency legacy_v2 Issues, discussions and PRs related to Version 2.x spotify edition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants