Play Spotify Tracks on Raspberry Pi

have Moddy with the Spotify extension Insatlliert. But if I want to play a song, it does not work. Can anyone help me.

My mopidy config looks like this:

# For further information about options in this file see:
#   http://docs.mopidy.com/
#
# The initial commented out values reflect the defaults as of:
#   Mopidy 2.1.0
#   Mopidy-File 2.1.0
#   Mopidy-HTTP 2.1.0
#   Mopidy-Local 2.1.0
#   Mopidy-M3U 2.1.0
#   Mopidy-MPD 2.1.0
#   Mopidy-SoftwareMixer 2.1.0
#   Mopidy-Stream 2.1.0
#
# Available options and defaults might have changed since then,
# run `mopidy config` to see the current effective config and
# `mopidy --version` to check the current version.

[core]
#cache_dir = $XDG_CACHE_DIR/mopidy
#config_dir = $XDG_CONFIG_DIR/mopidy
#data_dir = $XDG_DATA_DIR/mopidy
#max_tracklist_length = 10000
#restore_state = false

[logging]
#color = true
#console_format = %(levelname)-8s %(message)s
#debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
#debug_file = mopidy.log
#config_file =

[audio]
#mixer = software
#mixer_volume = 
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo
#buffer_time = 

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

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

[http]
#enabled = true
hostname = 127.0.0.1
#port = 6681
static_dir = /opt/webclient
#zeroconf = Mopidy HTTP server on $hostname

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

[m3u]
#enabled = true
#base_dir =
#default_encoding = latin-1
#default_extension = .m3u8
#playlists_dir =

[softwaremixer]
#enabled = true

#[file]
#enabled = true
#media_dirs = /home/pi/spotify_music
#  $XDG_MUSIC_DIR|Music
#  ~/|Home
#excluded_file_extensions = 
#  .jpg
#  .jpeg
#show_dotfiles = false
#follow_symlinks = false
#metadata_timeout = 1000

[local]
enabled = false
#library = json
#media_dir = /home/music_spotify
#scan_timeout = 1000
#scan_flush_threshold = 100
#scan_follow_symlinks = false
#excluded_file_extensions = 
#  .directory
#  .html
#  .jpeg
#  .jpg
#  .log
#  .nfo
#  .png
#  .txt

[spotify]
enabled = true
username = my_username
password = my_password
client_id = my client_id
client_secret = my client_secret

The commands look like this:

pi@raspberrypi:~ $ mpc clear
volume: n/a   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:~ $ mpc add https://open.spotify.com/track/0tKcYR2II1VCQWT79i5NrW
pi@raspberrypi:~ $ mpc play
https://open.spotify.com/track/0tKcYR2II1VCQWT79i5NrW
[playing] #1/1   0:00/0:00 (0%)
volume: n/a   repeat: off   random: off   single: off   consume: off

If I play another stream over mpc it works. Only with a Spotify Link it does not work.

Can someone help me with this problem?

check the mopidy log to find out what is wrong.

Mopidy-Spotify does not understand http URIs. You should using something like spotify:track:0tKcYR2II1VCQWT79i5NrW

When I use it, i get an error.

pi@raspberrypi:~ $ mpc clear
volume: n/a   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:~ $ mpc add spotify:track:0tKcYR2II1VCQWT79i5NrW
error adding spotify:track:0tKcYR2II1VCQWT79i5NrW: Not found

That exact command works for me here. Perhaps check the log as @mczerski suggests. Are you sure the track is available in your region?

Yes the track should be available in my region. I can also hear it in the desktop application. I have tried the command synonymous with other tracks.

Okay I will look at the log. Thanks in advance for your help

API has changed. You need to add this to your config: https://www.mopidy.com/authenticate/#spotify

The client_id/client_secret oauth authentication is required only for the functionality that uses Spotify’s Web API; that is currently limited to searching, images and the MPD list command. And if you look at the config you’ll see it’s already defined. If we are to get any further we need the log.

This isn’t actually Pi Musicbox, is it?