RFID player for raspberry pi. Using Mopidy/MPD to play back songs triggered by RFID cards. This is currently in very early development and should be considered a hack/learning project for me. There likely many security and stability issues with the code. Use at your own risk.
System tested on a raspberry pi 3 running a Raspian lite. Playbox is deployed using a docker container, so before starting docker has to be installed on the raspberry pi.
Since playbox is still under development the best way to find out needed system requirements is to look inside the Dockerfile. The container image is currently not available from dockerhub or similar, because the spotify credentials are currently stored within.
First build the python package as a source distribution
python3 setup.py sdist
this will create the folder dist
containing the python package
Next build the docker container. The client ID and client secret can be generated by registering mopidy-spotify.
export SPOTIFY_USER="your_spotify_username"
export SPOTIFY_PASS="your_spotify_password"
export SPOTIFY_CLIENT_ID="00000000-0000-0000-0000-000000000000"
export SPOTIFY_CLIENT_SECRET="00000000_00000000000000000_00000000000000000"
docker build . -t playbox --rm --build-arg SPOTIFY_USER=${SPOTIFY_USER} \
--build-arg SPOTIFY_PASS=${SPOTIFY_PASS} \
--build-arg SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID} \
--build-arg SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET}
The client ID and client secret can be generated by registering mopidy-spotify and then stored in /var/playbox/spotify.conf
[spotify]
username = your_spotify_username
password = your_spotify_password
enabled = true
client_id = 00000000-0000-0000-0000-000000000000
client_secret = 00000000_00000000000000000_00000000000000000
After the docker container is built and named playbox
starting the container is done by systemd.
copy the resource/playbox_container.service
to /etc/systemd/system
then reconfigure systemd.
sudo systemctl daemon-reload
sudo systemctl enable playbox_container.service
Matchings between RFID tag-IDs and audio URIs are stored in /home/pi/audio.csv
the format is
|TagID|AudioURI|
pytest
user should be member of group input
to access devices
evdev documentation
https://python-evdev.readthedocs.io/en/latest/
python packaging help: https://docs.python.org/3/distutils/setupscript.html
Debian packaging intro: https://wiki.debian.org/Packaging/Intro?action=show&redirect=IntroDebianPackaging
It is suggested to set up a virtualenv to develop the playbox
pip3 install virtualenv
virtualenv .venv