aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2022-12-26-spotifyd.smd
blob: ded36f7481d5a68dfe637da08ef8c2a6c6bfce82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---
.title = "Spotifyd",
.author = "Martin Ashby",
.date = @date("2022-12-26T23:08:03Z"),
.layout = "single.shtml",
.custom = {"comments": true},
---

I recently discovered [spotifyd](https://spotifyd.github.io/), an open source alternative to the deprecated libspotify. I happened to also have a [pi-zero W](https://www.raspberrypi.com/news/raspberry-pi-zero-w-joins-family/) from a while back, and a [pHAT DAC](https://learn.pimoroni.com/article/raspberry-pi-phat-dac-install) amplifier.

It was a relatively trivial job to set up the pi zero w headless, get audio output to the pHAT DAC, install spotifyd and use it as a spotify connect device connected to my old [Cambridge Audio A1](http://www.hi-fi-insight.com/cambridge-audio-a1-integrated-amplifier.html).

Install guides: 
- [raspberry pi headless](https://www.raspberrypi.com/documentation/configuration/wireless/headless.md), since I last used this, userconf.txt was added which allows setting up a proper user with a unique password! Bonus security points.
- [spotifyd](https://spotifyd.github.io/spotifyd/installation/Raspberry-Pi.html), zero-w requires the arm-v6 variant, luckily they build releases for this architecture! Building on the pi-zero could take a while.
- [phat-dac](https://learn.pimoroni.com/article/raspberry-pi-phat-dac-install)
- [tailscale](https://tailscale.com/kb/1025/install-rpi/), not strictly necessary, but nice to have
- and [ufw](https://help.ubuntu.com/community/UFW) and [unattended-upgrade](https://manpages.ubuntu.com/manpages/bionic/man8/unattended-upgrade.8.html), just for the additional security and sanity. Note that you must set spotifyd to listen on a fixed port for disovery to work, and allow that port in the firewall! Specifically set `--zeroconf-port <number>` either via command line or in the configuration file, and allow connections with `sudo ufw allow <number>`

I tried a similar project a few years ago, using [MPD](https://www.musicpd.org/) and spotify plugin, but at the time it was too unreliable. Thanks to the folks who spent the time creating spotifyd!

I should get a case for the pi some time, at the moment it's just freely sitting on the shelf next to the speakers.