Its probably not the best way, Im not very good with python, also It wouldnt play until i removed the section of code that looks for a pause card. I modified box.py with a few lines that look for “http:” in plist and to use the add method if its found, and the load method if is isnt. Someone suggested changing the “client.add” method to “client.load” in box.py, This worked for me, I could then play local mp3’s from a playlist, but internet radio streams stopped working, I presume they need the client.add method. Also thanks to the many comments here, I also had a probmlem playing local files.
Wow ! Thanks Francisco, your scripts work really well. T23:34:12.899Z – info: CoreStateMachine::syncState T23:34:12.898Z – info: CoreCommandRouter::servicePushState Skipping notification.Current spop Received mpd
T23:34:12.902Z – info: Received update from a service different from the one supposed to be playing music. When scanning the car it connects fine, but i think it is happening when using ay() or mpdclient.add().
I think I maybe found why the problem is occuring, but I havnt found out how to fix it yet. If you have any questions, comments or improvements I am more than happy to hear them! You can do so by following this tutorial for example. Last thing is that you may want to include the script box.py to the startup. All the code is open source and you are more than welcome to contribute! After adding some cards and playlists, run ‘python box.py’ and you are all set. You can get the Spotify URI in the Spotify desktop app by right-clicking any song, album, playlist or radio station that you want. Then run the script called add_cards.py, where you can assign an Spotify URI to a card number using the reader. First run ‘python config.py’ to configure the card reader. To read the cards and control the MPD, I wrote a script that can be found here.
It creates a music player daemon (MPD) and a web server, so it also provides a web interface to control your music.
Now, if you want to use another board (Beagle Board Black, for example), you can just install Mopidy, which is the base of Pi Musicbox. Remember to enable the SSH connection in the settings.
You can follow the instructions in their website to install the image to the Raspberry Pi. To handle the connection to Spotify, I use the image from Pi Musicbox. Just connect the RFID reader to the USB port and the sound card too.