Skip to content

Install rfid mopidy go

Wout Slakhorst edited this page Mar 4, 2021 · 5 revisions

As you can see I didn't provide any binaries, cross-compiling for an ARM cpu from a Mac is a pain-in-the-ass. So I ended up installing golang and just used go get.

sudo apt-get install golang-go

Setup your path stuff and add it to .bashrc. Then just:

go get github.com/woutslakhorst/eneby-jukebox/rfid-mopidy-go

If $gopath/bin has been added to your path then the executable should be available.

Install service

The executable should be started when the system starts up. Therefore I added a rfid-mopidy.service file in the repo. It has to be copied to the Pi (/lib/systemd/system/) and can be enabled via:

sudo systemctl daemon-reload
sudo systemctl enable rfid-mopidy.service

Configure

The only thing left is to map RFID cards to Spotify playlists. For this you need the card numbers (should be on cards) and Spotify URI's. The URI's can be obtained from the Spotify client by right-clinking any album or playlist and choosing share->copy URI.

The rfid-mopidy-go client will look in /etc/rfid-mopidy-go for a file called rfid-mopidy-go.yaml. Below is an example:

mappings:
  # met de boys
  "0001685914": "spotify:playlist:5vuSj9MXB11ZiLulJjx0Ag"
  # Ernst, Bobby en de rest, de leukste kinderliedes
  "0": "spotify:album:30Wo9HOMHXB2zCJ6RmOpsV"
  # Dirk schele, in holland staat een huis
  "1": "spotify:album:2vrUceCi1EenyC0ZZsXMUR"
  # Koningsspelen 2019
  "2": "spotify:playlist:4LNb2mVLbzQ4yrLwEiULgW"
  # Kinderliedjes NL
  "3: "spotify:playlist:4Xsg6OEIFvswCzGlYwZqLW"
  # Hupsakee!
  "4: "spotify:track:6HlHlXL1wxWFMM6j5pRXyQ"
  "0001691887": "STOP"
  "0001698350": "EXIT"
  "0001700873": "NEXT"
  "0001706370": "PREV"

Where each index is a card number and the value is a spotify URI or the hardcoded STOP, NEXT, PREV or EXIT

Clone this wiki locally