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

Play Spotify #18

Closed
infomobi opened this Issue Mar 9, 2018 · 125 comments

Comments

Projects
None yet
@infomobi
Copy link

infomobi commented Mar 9, 2018

Hello,

thanks for the great work.
Will it be possible to play songs or playlists from Spotify premium?

Thanks four your help!

@tullm

This comment has been minimized.

Copy link

tullm commented Mar 9, 2018

Hi.
Yes this is possible. I've done it.
I've installed mopidy which included mpd.
I can trigger to play spoitfy content over mpd with the swipe of a RFID tag.
So install mopidy with the Spotify extension. When this is done and you are able to play Spotify over mopidy it is only some editing of the script here to get it working with RFID. I can share what I've edited.
Cheers

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Mar 10, 2018

Thanks for your answer.
Would it be possible to make a little tutorial with all steps that I have to do (similar to the install guide of RPI-Jukebox-RFID)?
That would be very helpful :-)

@tullm

This comment has been minimized.

Copy link

tullm commented Mar 10, 2018

Hi. Don't remember it step by step, but have a look here: #5 (comment) there is a link to the tutorial that I used to install it.
Good luck...

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Mar 10, 2018

OK, installation is not the problem with the tutorial.
But how can I configure triggering a playlist or album with RFID?

@tullm

This comment has been minimized.

Copy link

tullm commented Mar 11, 2018

Give me a day or two for the answer. Will get back to you here...

@tullm

This comment has been minimized.

Copy link

tullm commented Mar 12, 2018

So,

if you have installed mopidy and spotify premium ist working for you you can go on like that:

I've crated a variable in the "rfid_trigger_play.sh" under /home/pi/RPi-Jukebox-RFID/scripts like that:

CMDMUSIK1="0001234567 (the number represents the number from the rfid card.

Then i added another command (right under all the other commands)in the same script like that:
elif [ "$CARDID" == "$CMDMUSIK1" ]
then
# stop VLC and Start SpotifyPlaylist Musik1
mpc -p 6681 stop && mpc -p 6681 clear && mpc -p 6681 load Musik1 && mpc -p 6681 volume 80 && mpc -p 6681 play && sudo pkill vlc <- this whole mpc stuff is one line

So when you swipe the card 0001234567 it detects the special card which triggers the command. the commant stops mpc if it is playing, clears the current playlist, loads the Playlist Musik1 from spotify, sets volume to 80%,starts playing and kills vlc. You can load all playlists here by name. Or with the us of the uri url from spotify.

All command available are listed here: https://linux.die.net/man/1/mpc

I also made it possible to trigger paue, next and so on by adding these command to the normal command within the script like that:

elif [ "$CARDID" == "$CMDPAUSE" ]
then
# pause VLC media and mpc
echo "pause" | nc.openbsd -w 1 localhost 4212
mpc -p 6681 toggle

And also I added these 2 mpc lines way down in the script to stop mpc if a rfid card for vlc player is used:

# first kill any possible running vlc processn => stop playing audio
sudo pkill vlc
mpc -p 6681 stop
mpc -p 6681 clear

enjoy.

hope that helps.
tullm

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Mar 14, 2018

Thank you, that helped a lot and now it works fine.

I made a little addition to the code to make everything a little more flexible. I can add new spotify playlists to the jukebox without editing the script. I just have to create a new audiofolder with a file named playlist.spotify. The content of this file is the name of the playlist.

Here is the code in rfid_trigger_play.sh:

        if [ -f $PATHDATA/../shared/audiofolders/$FOLDERNAME/playlist.spotify ]
        then
                playlistname=`cat $PATHDATA/../shared/audiofolders/$FOLDERNAME/playlist.spotify`
                sudo pkill vlc && mpc clear && sleep .1 && mpc load $playlistname && sleep .1 && mpc play
        else

You just have to insert it in the right place:

    # if a folder $FOLDERNAME exists, play content
    if [ -d $PATHDATA/../shared/audiofolders/$FOLDERNAME ]
    then
INSERT HERE
                # create an empty string for the playlist
                PLAYLIST=""

Again, thanks for your help.

PS: Sometimes, spotify stops working on my machine. The logfile shows that loading a playlist runs into a timeout. Do you have the same problem?

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Mar 14, 2018

I am planning to add the spotify option to the script in core. However, since I have no spotifiy (...) can somebody give me a brief "install" info here for the initial steps to get the Pi ready for spotify? Or should I just refer to the link posted by @tullm ?

To add spotify-connect I used: https://github.com/dtcooper/raspotify
tutorial to install is on github there.

@tullm

This comment has been minimized.

Copy link

tullm commented Mar 14, 2018

@MiczFlor Hi, great. But the link you postet is for spotify connect, not for spotify itself.

this ist the right one:

To add the Mopidy Music Server (for local or networkfiles, spotify and other music services) I used: https://www.mopidy.com/
tutorials:
english: https://maex.me/2017/10/raspberry-pi-as-a-music-server/
german: https://braspi.de/blogs/braspi-blog/raspberry-pi-als-musik-server-mit-mopidy
or the very good documentation from mopidy: https://docs.mopidy.com/en/latest/
I used extensions: spotify, local-images (cover database for local or network files), iris (webinterface), local files.

If you need help or testing let me know. (also in german if neede ;-) )

@infomobi ohh, that sound very interesting. Will try it. The Foldername ist the cardnumber then? And no, as long as the pi has network access it is working good...

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Mar 15, 2018

The foldername in audiofolders is an alias like "Karneval" and includes the file playlist.spotify with the name of the playlist as content.
The automatically created folder CARDID in folder shortcuts points to this folder like it does with normal mp3-playlists.

@MiczFlor I can try to write the "step-by-step install" for spotify in the next days. You have to add my extension of your script to rfid_trigger_play.sh then.

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Mar 15, 2018

@MiczFlor Hi, Spotify Connect is not needed. I have integrated spotify into my Pi by using Mopidy + MPC.
To get this working i created two options: Normal mode and Shuffle Mode.
I need one file in my audiofolder: "spotify.txt" or "spotifyshuffle.txt". Into that file i have to put the URL of the spotify playlist.

PS:
I made some improvements to the webinterface too:
-Play button is working for spotify
-Playing song is shown
-Covers integrated to the UI
-Added + and - buttons for Volume
-Added a filemanager to directly edit/delete the shortcuts and upload/edit/delete files to audiofolders
-Added direct links to the UI for editing/deleting shortcuts and audiofolders
-Some improvements for user friendlyness

Other improvements to rfid_trigger_play.sh:
-Added some association options to cards (shuffle, reboot, volume up, volume down ....)
-spotify integration
-shuffle for VLC and spotify
-automatic audiofolder creation (if shortcut points to an audiofolder which doesn't exist, it will be automatically created by reading the card again)

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Mar 15, 2018

hi @princemaxwell thanks for your input. If you were to share your work here or as a pull request, I would like to review and include it, if that is possible? And please don't forget to post a picture of your jukebox in the other thread to be included in the image gallery ;)

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Mar 15, 2018

@MiczFlor sure, thats possible.
i will send you the files on evening...

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Mar 17, 2018

Would you publish the files for testing here @MiczFlor and @princemaxwell?
I would love to test everything.

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Mar 17, 2018

I have to remove some very individual adjustments from my code, which are only affecting my system.
And i have to add some comments...

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Mar 18, 2018

@princemaxwell ok, thanks for the feedback. Looking forward to the code.

@infomobi

This comment has been minimized.

Copy link
Author

infomobi commented Apr 25, 2018

@princemaxwell Any progress here? I would love to test everything. Thanks!

@pheck

This comment has been minimized.

Copy link
Contributor

pheck commented Apr 29, 2018

based on the infos linked in this thread, I could successfully add spotify support on my system. (Thanks, everyone!)
I've adopted the modifications @infomobi did to rfid_trigger_play.sh in #18 (comment) with one small change:
The original command:
sudo pkill vlc && mpc clear && sleep .1 && mpc load $playlistname && sleep .1 && mpc play
won't be executed if vlc (i.e. any playback other than spotify) isn't running because the pkill command returns with an errorlevel != 0 when it has nothing to kill, and due to the &&-linkage, the the command execution stops here.

I changed it to
sudo pkill vlc ; mpc clear && sleep .1 && mpc load $playlistname && sleep .1 && mpc play
so the command continues regardless of pkill's result.

Of course there are cleaner approaches that involve checking if there's actually a process to kill, ensuring it has been killed and so on, but this "fix" is keeps it simple and so far, it is working for me.

HTH

@nlssttzl

This comment has been minimized.

Copy link

nlssttzl commented Aug 17, 2018

Hey guys. Thanks for your great contribution. Without you I would have been able to manage to install all this.
An idea how the code should look like for v1.0?

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Aug 17, 2018

Hi @nlssttzl
Good point. This thread needs to go into the documentation for the branch with the old vlc code.
And if nobody else ventures into the new mpd version, I might need to get a Spotify account to figure out. It will take a few weeks. Busy with consolidating a few improvemebts and other tickets.
But thanks for reminding me. It will come.
All the best, micz

@nlssttzl

This comment has been minimized.

Copy link

nlssttzl commented Aug 18, 2018

Actually this shouldnt be too much of a problem since all the commands still work. So via console it is still possible to steer Spotify. I should even get easier since you just have to worry about mpc and not vlc.
Just have to figure out where and how to integrate it into your script and start playing once the card is being swiped.
Too bad I’m a really bad at programming. Maybe I’ll spend 1-2 evenings figuring out and trying around. However I would be glad if someone shares their experience.

@nlssttzl

This comment has been minimized.

Copy link

nlssttzl commented Aug 19, 2018

So I`m back from bouncing some ideas back and forth and I managed to get it running. Unfortunatly not with the more easy version of @infomobi but nevertheless, better than nothing. It should be possible to include the whole play/stop as well, but here finally my noob-skills are too noob.
In addition I did not manage yet to stop spotify when playing a "regular" card.
Well here's what I got:

First link a command to the card swiped in the settings/rfid_trigger_play.conf:
cmdplayspotify="0002763033"
Whereas the number matches the RFID-tag.

After that create in the scripts/rfid_trigger_play.sh in the section where all the case commands are (after: case $CARDID in

$cmdplayspotify) mpc stop ; mpc clear; mpc -p 6601 stop; mpc -p 6601 clear; mpc -p 6601 load auto && mpc -p 6601 play ;;
In that case "auto" is my spotify list. That command stops all "regular cards" and all running "spotify cards". 6601 is in my case the port which is being defined in the mopidy.conf

That's it. Not much but in a first step it's running. Next step now would be to include start/stop and to so playing spotify once a "regular card" is being swiped.

EDIT:
Just realized that it's quite easy to include all the necessary mopidy commands into the /scripts/rfid_trigger_play.sh right under the whole case $CARDID in-Sektion.

e.g. for stop:
$CMDSTOP) # kill all running audio players $PATHDATA/playout_controls.sh -c=playerstop; mpc -p 6601 stop;

That make the whole thing of having "common" command cards for modipy and "regular" mpd/mpc quite easy. Start/Stop should be possible somehow as well.

@no-banker

This comment has been minimized.

Copy link

no-banker commented Sep 18, 2018

First thanks a lot for the great work and the great idea! My first steps are done but now I want to integrate Spotify and I read this post.

@MiczFlor If I understood right you want to integrate the Spotify support in one of the next versions. You have an idea when you start with the implementation? I ask because If you are right now working on it I don’t start with the dirty version if the integration is already in progress. If you need help by testing this feature and if I’m able to help feel free to contact me.

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Sep 19, 2018

Hi @no-banker
thanks for offering support. A "working hack" is all we need at this stage for the latest phoniebox version.
How would you approach the issue?
If you get started on this, could you have a look at http://tizonia.org/ ?
My thoughts were to use this software as part of phoniebox. It it works, I would then add it to the install script.

@no-banker

This comment has been minimized.

Copy link

no-banker commented Sep 21, 2018

Hi @MiczFlor

Tonight I had time to test with tizonia. Seems to be a propper solution. But you have to install several tools on top:

pip install spotipy

pip install fuzzywuzzy

sudo apt-get install pulseaudio

I have tried to do everything without config file in tizonia by using the following command

tizonia --spotify-user myusername --spotify-password mypwd --spotify-playlist nameofplaylist

Afterwards you can steer with the keyboard:

Keyboard control:

[p] skip to previous file.
[n] skip to next file.
[SPACE] pause playback.
[+/-] increase/decrease volume.
[m] mute.
[q] quit.

These are all options for spotify which you can use:

Spotify options (Spotify Premium required):
--spotify-user arg Spotify user name (not required if provided via
config file).
--spotify-password arg Spotify user password (not required if provided via
config file).
--spotify-owner arg The owner of the playlist (optional: may be used in
conjunction with --spotify-playlist).
--spotify-tracks arg Search and play from Spotify by track name.
--spotify-artist arg Search and play from Spotify by artist name.
--spotify-album arg Search and play from Spotify by album name.
--spotify-playlist arg Search and play public playlists (owner is assumed
current user, unless --spotify-owner is provided).

Hopefully you can integrate it with this information? Sorry but I don’t have the skills to write the code.

@bgraeb

This comment has been minimized.

Copy link

bgraeb commented Sep 23, 2018

From what I can see, tizonia would not help at what we want to achieve, as it has no headless mode (right now).

I did a basic implementation with mopidy, but I had no time to integrate it.

This starts a playlist from Spotify:

from mpd import MPDClient

client = MPDClient()
client.timeout = 200
client.idletimeout = None
client.connect("localhost", 6600)
client.add("spotify:user:d5l7k1dqq59jr1qrtdlicykiq:playlist:1zVlcCYZ4BII9D7KMjceJv")
client.play()

As you can see, you can run this headless. One could use sys to read from stdin, as far as I can remember.

You need a registration at Spotify to create a authentication token: See here.

I need to upgrade my current installation. When I'm done, I'll take a look If I can integrate it (haven't had time to look into this project for a while - dunno how far you got).

@Alwiz79

This comment has been minimized.

Copy link

Alwiz79 commented Sep 23, 2018

@bgraeb this seems to be in general a pretty interesting thread you linked there.

mopidy/mopidy-spotify#182 (comment)

I also think that Tizonia won’t help us. In the above thread someone mentions he uses NFC cards that hold a Spotify uri to be played and passes that on to mopidy :-)
And your first trials look good.
I’ll return from holidays in around two weeks, will try to help then if it’s not solved until then

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Sep 24, 2018

Hi @bgraeb @no-banker @Alwiz79
looking forward to get a Spotify account to test your pull requests :)
My hope for tiziona was that it would be a neat wrapper around not only Spotify but Google Music and other services. The issue at hand: is it "truely" headless. I haven't tried it.
Please take a look also at an older thread: #118 (comment)
There is some information on Spotify - which, as you can imagine without an account (yet!) - I haven't tested.
Keep the good thoughts and contributions coming!
all the best, micz

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Oct 25, 2018

@SmightyCrown

You need to install pyspotify.
By the way, update the extension mopidy-spotify too.

sudo apt-get install libspotify12 python-cffi python-ply python-pycparser python-spotify
sudo rm -rf /usr/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/lib/python2.7/dist-packages/Mopidy_Spotify-*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/Mopidy_Spotify-*
cd
sudo rm -rf mopidy-spotify
git clone -b fix/web_api_playlists --single-branch https://github.com/princemaxwell/mopidy-spotify.git
cd mopidy-spotify
sudo python setup.py install
cd
@SmightyCrown

This comment has been minimized.

Copy link

SmightyCrown commented Oct 25, 2018

@BlackLight
@princemaxwell
Thank you for the fast answer. After i installed pyspotiy and updated mopidy-spotify, it works without a error. The only thing is, that i cant add spotify albums to a card, only tracks.
With spotify:track:XXXX it works, with spotify:albumXXX in the spotify.txt file, mopidy brings an error: invalid id.

@dnkroy

This comment has been minimized.

Copy link

dnkroy commented Oct 25, 2018

Did YouTube Miss the : after Album?
spotify:albumXXX .
Maybe you got an user made album?

@SmightyCrown

This comment has been minimized.

Copy link

SmightyCrown commented Oct 25, 2018

Sorry, that was a typo and its not a user made album. When i try

spotify:album:6zeXEvQUwV55xFB8hSE9nT
or
spotify:user:1131479705:album:6zeXEvQUwV55xFB8hSE9nT

mopidy shows "Could not load track invalid id"

But with a playlist
spotify:user:1131479705:playlist:5HQNUKBdkSHpDA2n77LFW5
or a single track
spotify:track:0lq8zosTqXuSTkhk3ASVvl
it works.

So its ok for me.

@BlackLight

This comment has been minimized.

Copy link

BlackLight commented Oct 25, 2018

@SmightyCrown can you try from command line?

mpc add spotify:album:6zeXEvQUwV55xFB8hSE9nT

This exact command worked for me. Maybe there's a typo in the command you copied or the branch you cloned and installed is not up-to-date?

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Oct 25, 2018

@SmightyCrown
Did you try it via command line and MPC?

This cannot work, if you used something like
mpc load spotify:album:6zeXEvQUwV55xFB8hSE9nT

The reason is, that MPC load is for files. You had to use "mpc add spotify:track:0lq8zosTqXuSTkhk3ASVvl" instead.

In Phoniebox we route the playlist, album or track URI into a .m3u playlist file, which can be loaded via "mpc load ..."

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Oct 25, 2018

@Alwiz79 @MiczFlor @SmightyCrown

1.1.8-beta is live on the MASTER branch!

For everone who wants to test the newest version with some stability and speed optimizations, feel free to do it and give us a feedback please!

I updated the UPGRADE instructions today, but have to wait that @MiczFlor will merge this into develop.
Until he has done, here is the instruction.

cd /home/pi/RPi-Jukebox-RFID
git checkout master
git fetch origin
git reset --hard origin/master
git pull
sudo systemctl stop mpd
sudo systemctl stop mopidy

USERNAME=$(sudo grep 'username' /etc/mopidy/mopidy.conf|sed 's/username = //g'|sed 's/"//g'|tr -d "\n")
PASSWORD=$(sudo grep 'password' /etc/mopidy/mopidy.conf|sed 's/password = //g'|sed 's/"//g'|tr -d "\n")
CLIENT_ID=$(sudo grep 'client_id' /etc/mopidy/mopidy.conf|sed 's/client_id = //g'|sed 's/"//g'|tr -d "\n")
CLIENT_SECRET=$(sudo grep 'client_secret' /etc/mopidy/mopidy.conf|sed 's/client_secret = //g'|sed 's/"//g'|tr -d "\n")

sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/mpd.conf.sample /etc/mpd.conf
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/mopidy-etc.sample /etc/mopidy/mopidy.conf
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/mopidy.sample /home/pi/.config/mopidy/mopidy.conf

sudo sed -i 's/%spotify_username%/'"$USERNAME"'/' /etc/mopidy/mopidy.conf
sudo sed -i 's/%spotify_password%/'"$PASSWORD"'/' /etc/mopidy/mopidy.conf
sudo sed -i 's/%spotify_client_id%/'"$CLIENT_ID"'/' /etc/mopidy/mopidy.conf
sudo sed -i 's/%spotify_client_secret%/'"$CLIENT_SECRET"'/' /etc/mopidy/mopidy.conf
sudo sed -i 's/%spotify_username%/'"$USERNAME"'/' ~/.config/mopidy/mopidy.conf
sudo sed -i 's/%spotify_password%/'"$PASSWORD"'/' ~/.config/mopidy/mopidy.conf
sudo sed -i 's/%spotify_client_id%/'"$CLIENT_ID"'/' ~/.config/mopidy/mopidy.conf
sudo sed -i 's/%spotify_client_secret%/'"$CLIENT_SECRET"'/' ~/.config/mopidy/mopidy.conf

# services to launch after boot using systemd
# -rw-r--r-- 1 root root  304 Apr 30 10:07 phoniebox-rfid-reader.service
# 1. delete old services (this is legacy, might throw errors but is necessary. Valid for versions < 1.1.8-beta)
echo "### Deleting older versions of service daemons. This might throw errors, ignore them"
sudo systemctl disable idle-watchdog
sudo systemctl disable rfid-reader
sudo systemctl disable startup-sound
sudo systemctl disable gpio-buttons
sudo rm /etc/systemd/system/rfid-reader.service 
sudo rm /etc/systemd/system/startup-sound.service
sudo rm /etc/systemd/system/gpio-buttons.service
sudo rm /etc/systemd/system/idle-watchdog.service
echo "### Done with erasing old daemons. Stop ignoring errors!" 
# 2. install new ones - this is version > 1.1.8-beta
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-rfid-reader.service.stretch-default.sample /etc/systemd/system/phoniebox-rfid-reader.service 
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-startup-sound.service.stretch-default.sample /etc/systemd/system/phoniebox-startup-sound.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-gpio-buttons.service.stretch-default.sample /etc/systemd/system/phoniebox-gpio-buttons.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-idle-watchdog.service.sample /etc/systemd/system/phoniebox-idle-watchdog.service
sudo chown root:root /etc/systemd/system/phoniebox-rfid-reader.service
sudo chown root:root /etc/systemd/system/phoniebox-startup-sound.service
sudo chown root:root /etc/systemd/system/phoniebox-gpio-buttons.service
sudo chown root:root /etc/systemd/system/phoniebox-idle-watchdog.service
sudo chmod 644 /etc/systemd/system/phoniebox-rfid-reader.service
sudo chmod 644 /etc/systemd/system/phoniebox-startup-sound.service
sudo chmod 644 /etc/systemd/system/phoniebox-gpio-buttons.service
sudo chmod 644 /etc/systemd/system/phoniebox-idle-watchdog.service
# enable the services needed
sudo systemctl enable phoniebox-idle-watchdog
sudo systemctl enable phoniebox-rfid-reader
sudo systemctl enable phoniebox-startup-sound
sudo systemctl enable phoniebox-gpio-buttons


echo "classic" > /home/pi/RPi-Jukebox-RFID/settings/edition
EDITION=$(grep 'SPOTinstall' /home/pi/PhonieboxInstall.conf|sed 's/SPOTinstall="//g'|sed 's/"//g'); if [ $EDITION == "YES" ]; then echo "plusSpotify"; else echo "classic"; fi > /home/pi/RPi-Jukebox-RFID/settings/edition

sudo apt-get install libspotify12 python-cffi python-ply python-pycparser python-spotify
sudo rm -rf /usr/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/lib/python2.7/dist-packages/Mopidy_Spotify-*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/Mopidy_Spotify-*
cd
sudo rm -rf mopidy-spotify
git clone -b fix/web_api_playlists --single-branch https://github.com/princemaxwell/mopidy-spotify.git
cd mopidy-spotify
sudo python setup.py install

sudo reboot
@Alwiz79

This comment has been minimized.

Copy link

Alwiz79 commented Oct 26, 2018

@princemaxwell I followed your step by step above on my second Rpi hardware. But it didn't work as expected. So, I had a running spotify installation before (i had issues with local files here).

After the steps above, spotify integration was gone.
The GUI shows "classic" in the upper left corner, which might be a hint, that it's not the spotify version ?

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Oct 27, 2018

@Alwiz79

The important steps for updating are all the steps above.
The first block updates your phoniebox to 1.1.8-beta. the second stores your Spotify informations temporarily. The third copies the new configuration files of mopidy. The fourth block puts the temporarily stored user informations into configuration files. The fifth updates the services. The sixth identificates the edition. The last updates the mopidy-Spotify plugin.

For the identification of classic or non-classic the steps are:

echo "classic" > /home/pi/RPi-Jukebox-RFID/settings/edition
EDITION=$(grep 'SPOTinstall' /home/pi/PhonieboxInstall.conf|sed 's/SPOTinstall="//g'|sed 's/"//g'); if [ $EDITION == "YES" ]; then echo "plusSpotify"; else echo "classic"; fi > /home/pi/RPi-Jukebox-RFID/settings/edition

You can put it on command line either you did a fresh installation or not. But line by line...

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Oct 31, 2018

EVERYONE WITH PROBLEMS STARTING LOCAL PLAYLISTS HAS TO RUN THIS COMMAND ONCE:

Depending of the location of audiofolder (this is for default location):
sudo chmod -R 777 /home/pi/RPi-Jukebox-RFID/shared/audiofolders/

If you have +Spotify Edition (>=1.1.8-beta) you have to SCAN MUSIC LIBRARY

-> Renew your database under Folders & Files.

And please upload this file to fix the upload in the WebUI or wait until @MiczFlor has merged it!
princemaxwell@500922f

@shinebar1001

This comment has been minimized.

Copy link

shinebar1001 commented Nov 3, 2018

As mopidy is spamming the logfiles with logs like these

Nov 3 23:12:25 phoniebox mopidy[525]: INFO New MPD connection from [::ffff:127.0.0.1]:6600

I suggest to create a filter in the syslog to protect the SD-Card from wearing out:

sudo echo ':msg, contains, "New MPD connection from" ~' >/etc/rsyslog.d/mopidy.conf
service rsyslog restart

and change the logging options of mopidy as well:

sudo sed -i '/INFO/WARNING/' /etc/mopidy/logging.conf

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 5, 2018

@shinebar1001
Great! Thank you. I will integrate the fix into the install script and will pull request this...

@SmightyCrown

This comment has been minimized.

Copy link

SmightyCrown commented Nov 11, 2018

Is it possible to update from 1.8beta to 1.18rc2 by git pull or would be a clean install the bettet way? With the beta, i have sometimes problems with local files. Also after the workaround with chmod and renewing the database.

@ndd

This comment has been minimized.

Copy link

ndd commented Nov 11, 2018

First of all: thanks for the great work!

I've just installed Phoniebox 1.1.8-rc2 Spotify Edition and everything works fine, except for loading/playing playlists from Spotify. Tracks and Albums are fine and can easily played via command line or mapped to a card:
mpc add spotify:album:4O83oaztVuBlPDrp50Q3mh (works)
mpc add spotify:track:0aHq4pmQth8Ggj5LyFNBn9 (works)

mpc add spotify:user:Spotify:playlist:37i9dQZF1DXcF6B6QPhFDv (doesn't work)
mpc add spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn (doesn't work)

What am I doing wrong? :)
Or is this Mopidy issue the reason: mopidy/mopidy-spotify#182

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 11, 2018

@SmightyCrown
You can git pull the develop or master branch.
Follow this update guide to get it to the actual version:
#18 (comment)

and then

#18 (comment)

Or do a fresh install by install script and chmod the folder.

@ndd
Have you installed with one line script or have you updated? There is a fix for the playlist issues which is included in our version.

@ndd

This comment has been minimized.

Copy link

ndd commented Nov 12, 2018

@princemaxwell
I've used the one line script...
Where do I find the fix? What do you mean by "our" version?

Thanks a lot!

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 12, 2018

@ndd
Sorry. I didn't see yesterday. For playlists you have to use

mpc load "playlistname"

mpc add is not working for this

Please try the load command

@ndd

This comment has been minimized.

Copy link

ndd commented Nov 13, 2018

@princemaxwell
With mpc load "playlistname" I can only load local m3u-playlists, which are in the playlists folder...
This would be fine as long as I could reference a Spotify playlist within such a m3u playlist. But as I mentioned before, this does only work for tracks and albums.

Example 1: album.m3u
spotify:album:4O83oaztVuBlPDrp50Q3mh (works)

Example 1: myplaylist.m3u
spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn (doesn't work)

@shitzovran

This comment has been minimized.

Copy link

shitzovran commented Nov 15, 2018

@princemaxwell
With mpc load "playlistname" I can only load local m3u-playlists, which are in the playlists folder...
This would be fine as long as I could reference a Spotify playlist within such a m3u playlist. But as I mentioned before, this does only work for tracks and albums.

Example 1: album.m3u
spotify:album:4O83oaztVuBlPDrp50Q3mh (works)

Example 1: myplaylist.m3u
spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn (doesn't work)

Same Problem here... you got a solution by now? Artists, Tracks, Albums works fine. Just Playlists doesn't works

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 16, 2018

@ndd @shitzovran

I tested it here. i created a file "test.m3u" in my playlists directory under "/home/pi/RPi-Jukebox-RFID/playlists/".
The file has the follwing content, like you provided:
spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn

pi@phoniebox:~ $ mpc clear
volume: 10%   repeat: off   random: off   single: off   consume: off
pi@phoniebox:~ $ **mpc load "test"**
loading: test
pi@phoniebox:~ $ mpc play
volume: 10%   repeat: off   random: off   single: off   consume: off
pi@phoniebox:~ $ mpc status
DJ Rolando - Knights Of The Jaguar
[playing] #1/467   0:04/2:30 (2%)
volume: 10%   repeat: off   random: off   single: off   consume: off

So, for me it worked fine.

Please note: It is not possible to user command line to load playlists directly with spotify uri. if you try something like "mpc load spotify:user:blabla:playlist:blabla" this does not work.
You have to put this URI into a m3u file and then you can try
mpc load "filename"
Please put filename into quotation marks.

If this doesn't work, you have to put this on command line.

sudo apt-get install libspotify12 python-cffi python-ply python-pycparser python-spotify
sudo rm -rf /usr/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/lib/python2.7/dist-packages/Mopidy_Spotify-*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/mopidy_spotify*
sudo rm -rf /usr/local/lib/python2.7/dist-packages/Mopidy_Spotify-*
cd
sudo rm -rf mopidy-spotify
git clone -b fix/web_api_playlists --single-branch https://github.com/princemaxwell/mopidy-spotify.git
cd mopidy-spotify
sudo python setup.py install

And please be sure you have not installed more than one instance of mopidy-spotify.
Check this please!

@shitzovran

This comment has been minimized.

Copy link

shitzovran commented Nov 17, 2018

I don't know wht's wrong...

i create new Playlists in "/home/pi/RPi-Jukebox-RFID/playlists/"

the first: "Leo Lausemaus - Folge 01.m3u8". The file has the follwing content:
spotify:album:5N73vwGXol4maS9U6HLp0o

The Album works fine.

pi@raspberrypi:/ $ mpc clear
volume: 75%   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:/ $ mpc load "Leo Lausemaus - Folge 01"
loading: Leo Lausemaus - Folge 01
pi@raspberrypi:/ $ mpc play
volume: 75%   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:/ $ mpc status
Leo Lausemaus - Leo Lausemaus Titelsong
[playing] #1/23   0:15/1:19 (18%)
volume: 75%   repeat: off   random: off   single: off   consume: off

the other Playlist "test.m3u8" with follwing content:
spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn

pi@raspberrypi:/ $ mpc clear
volume: 75%   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:/ $ mpc load "test"
loading: test
mpd error: No such playlist
pi@raspberrypi:/ $ mpc clear
volume: 75%   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:/ $ mpc load "test"
loading: test
pi@raspberrypi:/ $ mpc play
volume: 75%   repeat: off   random: off   single: off   consume: off
pi@raspberrypi:/ $ mpc status
volume: 75%   repeat: off   random: off   single: off   consume: off

the playlist doesn't want to work. and no change after reinstallation.
Could it be, there is a problem in the 'One line install command' ?

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 17, 2018

@shitzovran
Don't use m3u8 anymore. The use of m3u8 is deprecated since version "rc1".
Try m3u and perhaps it works ;-)

Are you sure you have the newest release installed?

@shitzovran

This comment has been minimized.

Copy link

shitzovran commented Nov 17, 2018

No, the same Problem with m3u.
And without using m3u8, some of my local files won't play .
I just realized, i have the same problem with podcasts from Spotify...

@princemaxwell

This comment has been minimized.

Copy link
Contributor

princemaxwell commented Nov 17, 2018

@shitzovran
What version do you use?
Did you upgrade and did you followed ALL STEPS from the upgrade guide to get you version to 1.1.8-rc2??

@MiczFlor

This comment has been minimized.

Copy link
Owner

MiczFlor commented Nov 21, 2018

The code has moved on. I am closing this, assuming the later code solved it. :) All the best, micz

@ndd

This comment has been minimized.

Copy link

ndd commented Dec 16, 2018

I've just installed a clean and fresh Raspbian as well as the latest Phoniebox +Spotify Edition (1.1.8) via one line script.
Still having the problems with playlists mentioned above...

With mpc load "playlistname" I can only load local m3u-playlists, which are in the playlists folder...
This would be fine as long as I could reference a Spotify playlist within such a m3u playlist. But as I mentioned before, this does only work for tracks and albums.

Example 1: album.m3u
spotify:album:4O83oaztVuBlPDrp50Q3mh (works)
Example 1: myplaylist.m3u
spotify:user:tomorrowlandofficial:playlist:0yS25E7g9xQZ1Dst5SqUZn (doesn't work)

Songs and Albums are still working fine, no matter if I call them directly or via a m3u-playlist in the playlists folder.

@princemaxwell
I've run all your commands as well...

@ndd

This comment has been minimized.

Copy link

ndd commented Dec 16, 2018

Seems like this is still an "official" mopidy problem:
mopidy/mopidy-spotify#182

@kathateich

This comment has been minimized.

Copy link

kathateich commented Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.