I am trying to use mpc
command from a bash script to start playing some Spotify playlist, with no success.
If I add a Spotify album, it is working:
mpc add spotify:album:4KLATmGtZBcl8uliNUFp18
mpc play
but when I try to use a playlist I get errors:
mpc add spotify:user:spotify:playlist:3ZgmfR6lsnCwdffZUan8EA
error adding spotify:user:spotify:playlist:3ZgmfR6lsnCwdffZUan8EA: directory or file not found
Indeed, if I list Spotify resources from mpc I get this:
~ $ mpc ls "Spotify"
Spotify/Top tracks
Spotify/Top albums
Spotify/Top artists
It seems that mpc doesn’t see any Spotify playlist.
Any help?
The only workaround I have found is to add all spotify’s playlist tracks to a new mopidy local playlist. Then I can play that playlist with:
mpc load "New playlist name"
mpc play
But no way to directly play spotify’s playlists.
I was able to get this exact behavior to work a couple weeks ago by not including the user:userid
piece.
From my rc.local
mpc add "spotify:playlist:___playlist_id___"
mpc repeat on
mpc volume 100
mpc play
I actually copied one whole piece from the pimusicbox project. Here’s the full block. Works like a charm!
# This code waits for Mopidy and MPD to be ready to accept commands, then starts the designated Spotify playlist (Playlist Name)
while ! nc -q 1 localhost 6600 </dev/null;
do
sleep 15;
waittime=$((waittime+5));
if [ $waittime -gt 120 ]
then
echo "WARNING: Timeout waiting for Mopidy to start, aborting"
break;
fi
done
if [ $waittime -le 120 ]
then
echo "Mopidy startup complete, playing [Playlist Name]"
# sleep 120
mpc add "spotify:playlist:___playlist_id___"
mpc repeat on
mpc volume 100
mpc play
fi
Nope:
mpc add "spotify:playlist:2vsLfxofpWIxzJs39DswxX"
error adding spotify:playlist:2vsLfxofpWIxzJs39DswxX: directory or file not found
or:
mpc add spotify:playlist:37i9dQZF1E4jWvN4gAoPQN
error adding spotify:playlist:37i9dQZF1E4jWvN4gAoPQN: directory or file not found