A lightweight service that displays MPD (Music Player Daemon) album artwork on framebuffer devices like small TFT screens. Perfect for Raspberry Pi, mini PCs, or any Linux system with a framebuffer display.
- Real-time Album Art Display: Automatically fetches and displays album artwork from MPD
- HTTP API: Serves current album art and track info via HTTP endpoints
- Framebuffer Support: Direct rendering to framebuffer devices (e.g.,
/dev/fb0) - Automatic Updates: Uses MPD IDLE to detect track changes instantly
- Fallback Image: Displays default artwork when none is available
- Systemd Integration: Runs as a reliable system service
- Low Resource Usage: Minimal CPU and memory footprint
- SSH Tunnel Friendly: Access via localhost for secure remote viewing
- Python 3 (3.7 or newer)
- MPD (Music Player Daemon) - running and accessible
- fbi - framebuffer image viewer (
fbidapackage on Arch,fbion Debian/Ubuntu) - Framebuffer device (e.g.,
/dev/fb0) - typically/dev/tty1for console
python-mpd2- MPD client libraryPillow- Image processing
- Clone or download this repository:
cd /tmp
git clone <repository-url> mpd-framebuffer-display
cd mpd-framebuffer-display- Run the installer (requires root):
sudo ./install.shThe installer will:
- Check and prompt for missing dependencies
- Create a dedicated
mpdviewersystem user - Install files to
/opt/mpd_framebuffer/ - Set up the systemd service
- Configure and start the service
If you prefer manual setup:
- Install system dependencies:
# Arch Linux
sudo pacman -S python python-pip fbida
# Debian/Ubuntu
sudo apt install python3 python3-pip fbi- Install Python dependencies:
pip3 install -r requirements.txt- Create service user:
sudo useradd -r -s /bin/false -d /home/mpdviewer -G video,tty mpdviewer
sudo mkdir -p /home/mpdviewer- Copy files:
sudo mkdir -p /opt/mpd_framebuffer
sudo cp src/mpd_framebuffer_service_http.py /opt/mpd_framebuffer/
sudo cp -r assets /opt/mpd_framebuffer/
sudo chmod +x /opt/mpd_framebuffer/mpd_framebuffer_service_http.py- Run initial setup:
sudo -u mpdviewer python3 /opt/mpd_framebuffer/mpd_framebuffer_service_http.py --setup- Install systemd service:
sudo cp systemd/mpd_framebuffer.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable mpd_framebuffer.service
sudo systemctl start mpd_framebuffer.serviceThe service is configured via JSON file located at:
/home/mpdviewer/.config/mpd_framebuffer_service/config.json
{
"mpd_host": "localhost",
"mpd_port": 6600,
"mpd_socket": "",
"use_socket": false,
"mpd_password": "",
"output_dir": "/home/mpdviewer/.cache/mpd_framebuffer_service",
"current_filename": "current_cover.jpg",
"default_image": "/opt/mpd_framebuffer/assets/default_art.jpg",
"resize": [800, 480],
"display_method": "auto",
"display_cmd": "fbi -T 1 {path}",
"http_bind": "127.0.0.1",
"http_port": 8080,
"http_token": "<generated-token>"
}Key Settings:
resize: Dimensions for your display[width, height]display_cmd: Command to render images (usefbi -T 1 {path}for VT1)default_image: Path to fallback artworkhttp_port: Port for HTTP API (default: 8080)
To edit configuration:
sudo nano /home/mpdviewer/.config/mpd_framebuffer_service/config.json
sudo systemctl restart mpd_framebuffer.service# Check status
sudo systemctl status mpd_framebuffer.service
# Start service
sudo systemctl start mpd_framebuffer.service
# Stop service
sudo systemctl stop mpd_framebuffer.service
# Restart service
sudo systemctl restart mpd_framebuffer.service
# View logs
sudo journalctl -u mpd_framebuffer.service -f
# View application logs
sudo tail -f /home/mpdviewer/.cache/mpd_framebuffer_service/service.logThe service provides HTTP endpoints for remote access:
curl http://localhost:8080/current.jpg -o album.jpgcurl http://localhost:8080/status.jsonResponse:
{
"artist": "Artist Name",
"album": "Album Title",
"title": "Track Title",
"last_fetch": 1703361234.56,
"last_error": ""
}curl -X POST "http://localhost:8080/fetch?token=<your-token>"To access from a remote machine:
# On your remote workstation
ssh -L 8080:localhost:8080 user@your-server
# Then open in browser or curl
curl http://localhost:8080/current.jpg -o album.jpgTo display on a specific TTY (e.g., TTY1 connected to a monitor):
- Ensure the service user can access the TTY:
sudo usermod -a -G tty,video mpdviewer- Set
display_cmdin config to usefbiwith specific TTY:
"display_cmd": "fbi -T 1 {path}"- The systemd service is already configured for TTY1 in the provided service file
If you have a dedicated framebuffer device:
"display_cmd": "fbi -d /dev/fb0 -T 1 --noverbose {path}"# Check service status
sudo systemctl status mpd_framebuffer.service
# Check logs
sudo journalctl -u mpd_framebuffer.service -n 50- Verify fbi is installed:
which fbi - Check framebuffer access:
ls -la /dev/fb0 - Verify TTY permissions:
groups mpdviewershould includevideoandtty - Check display_cmd in config
- Verify MPD is running:
systemctl status mpd - Check MPD connection settings in config.json
- Test MPD connection:
mpc status
- Ensure MPD has album art embedded or in music folders
- Check logs for errors:
tail -f /home/mpdviewer/.cache/mpd_framebuffer_service/service.log - Manually trigger fetch via HTTP API
To remove the service:
sudo ./uninstall.shThe uninstaller will:
- Stop and disable the service
- Remove service files
- Optionally remove the service user and data
mpd-framebuffer-display/
├── src/
│ ├── mpd_framebuffer_service_http.py # Main service script
│ └── display_art.sh # Legacy shell script (optional)
├── systemd/
│ └── mpd_framebuffer.service # Systemd service file
├── assets/
│ └── default_art.jpg # Default fallback image
├── install.sh # Installation script
├── uninstall.sh # Uninstallation script
├── requirements.txt # Python dependencies
└── README.md # This file
To test without installing:
# Install dependencies in a virtual environment
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Run setup
python3 src/mpd_framebuffer_service_http.py --setup
# Run service
python3 src/mpd_framebuffer_service_http.pyThis project is provided as-is for personal and educational use.
Contributions welcome! Feel free to submit issues or pull requests.
Created for displaying album artwork on small framebuffer displays with MPD music servers.