Tiny Core Base > Raspberry Pi
Spotify connect (librespot) on piCore
Gerrelt:
Hi all,
I've got Spotify connect with librespot working on piCore, and I wanted to share how I did it.
With librespot running, your raspbery pi will show up in the Spotify app under "devices available".
When selected, the song will be played on your raspberry instead of your phone.
(NOTE: I believe this does not work with a free spotify account)
Librespot uses "libportaudio2" which wasn't available on piCore, so I compiled it, and made a .tcz package for it.
To get it all running, execute these commands:
--- Code: ---mkdir librespot
cd librespot
# libportaudio2 compiled and packaged by me, and source downloaded from:
# http://www.portaudio.com/download.html
wget http://www.gerrelt.nl/RaspberryPi/libportaudio2.tcz -P /mnt/mmcblk0p2/tce/optional
sudo echo "libportaudio2.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
# librespot compiled by me, and source downloaded from:
# https://github.com/librespot-org/librespot
wget http://www.gerrelt.nl/RaspberryPi/SpotifyRadio/librespot.tar.gz
tar -xvzf librespot.tar.gz
sudo mv librespot /mnt/mmcblk0p2/tce
chmod u+x /mnt/mmcblk0p2/tce/librespot
--- End code ---
To start it at boot, you will have to choose a soundcard first.
Execute:
--- Code: ---aplay -l
--- End code ---
or
--- Code: ---cat /proc/asound/cards
--- End code ---
And see wich soundcard number and device number you want to use.
Open bootlocal.sh:
--- Code: ---sudo nano -\$\icwS /opt/bootlocal.sh
--- End code ---
And add this line to the end:
--- Code: ---/mnt/mmcblk0p2/tce/librespot --name YourSpotifyConnectDevicename --cache /tmp --bitrate 320 --initial-volume 100 --backend alsa --device hw:0,0 > /dev/null 2>&1 &
--- End code ---
Now, change "--device hw:0,0" to the choosen soundcard and device number, this example uses soundcard 0 and device 0.
Also check if you want to set the initial volume to 100%. If you adjust volume by a physical volume knob, you probably want it set to 100. If you use a software "volume knob", you probaly want to set it to something a lot lower. ;D
See option "--initial-volume 100" to change it.
You will also want to change "--name YourSpotifyConnectDevicename" to give your device a recognizable name.
Exit nano with CTRL-X, save the file, and make all your changes persistent by executing:
--- Code: ---filetool.sh -b
--- End code ---
Reboot your raspberry pi, and when booted, it should appear under "devices available".
Enjoy! 8)
Gerrelt:
For who is interested in this...:
I had some problems with tracks not starting or skipping to the end of the songs, so I compiled Librespot again with the latest sources.
This solved it for Raspbian, but not for piCore.
It turned out the problem was that I didn't set the timezone on my piCore installations. You can check by executing the "date" command and compare it to the actual time.
After some (long) searching I found how to set the timezone.
I set it like this:
--- Code: ---mount /dev/mmcblk0p1
--- End code ---
Open cmdline.txt it in nano:
--- Code: ---sudo nano -\$\icwS /mnt/mmcblk0p1/cmdline.txt
--- End code ---
And add to the end (with a space before it to seperate it from the other settings):
--- Code: ---tz=CET-1CEST,M3.5.0,M10.5.0/3
--- End code ---
(NOTE: this is for Europe/Amsterdam)
Save and close the file and do a backup:
--- Code: ---filetool.sh -b
--- End code ---
After a reboot the timezone was correct and Spotify connect worked correctly again.
Sidenote, you can check wat the tz string should be if you have a Raspbian installation:
--- Code: ---cat /usr/share/zoneinfo/Europe/Amsterdam
--- End code ---
This will produce some garbage, but in between it will mention the timezone string.
mickeyarthy:
This feature makes spotify playback easy with picoreplayer.
Thanks to Mr. Gerrelt for sharing this setup.
Zizico2:
I have followed your steps. It doesn't start on boot. If I run '''/mnt/mmcblk0p2/tce/librespot --name YourSpotifyConnectDevicename --cache /tmp --bitrate 320 --initial-volume 100 --backend alsa --device hw:0,0 > /dev/null 2>&1 &''' manually (sudo) I get the desired result, but bootlocal doesn't seem to be able to start librespot...
Is bootlocal called to early?! idk...
RomanoFX:
On boot, I got the same issue. It only works when I launch it manually. Do you have an idea?
Navigation
[0] Message Index
[#] Next page
Go to full version