The goal of this project was to use an NFC tag reader to play media from a selection of playlists. In this setting, an NFC tag maps N:1 to a playlist; there can be many NFC tags for a playlist, but we only select one playlist for each NFC tag.
This project can be used as a juke box replacement for home use, or as an audio book machine for kids.
In order not to reinvent the wheel too many times, this implementation uses MPD to manage music, playback, and playlists; the Python service implemented herein merely sends playback control commands to mpd.
- Placing an NFC tag on the reader will send a command to mpd to clear the playlist (stop playback), load a new playlist with the name specified on the NFC tag, and start playing back that playlist.
- Removing the tag from the range of the reader will pause playback.
- Placing the same NFC tag back on the reader will resume playback of the currently selected playlist from the current position.
- Placing a different NFC tag on the reader will start playing back another playlist; the current position in the currently playing playlist will be lost.
There are currently still some flaws with the way the jukebox is implemented:
- Some playlists should be played in shuffle mode, while others should not; it should be possible to embed a shuffle flag into the NFC tag.
- The alsa Bluetooth implementation (bluealsa) appears to be unmaintained and is unstable; it would be better to migrate to pulseaudio or pipewire.
Some more features that could be implemented later:
- Volume control using buttons
- Support for an I²C display to show current playback information from mpd