Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Jukebox [gukebox]

Bring a physical experience back to music streaming with NFC tags.

Pick an album, place it on the reader, and the music starts playing. Remove it, and playback pauses automatically.

gukebox last version license actions status

rpi python versions uv Ruff ty


📋 Table of contents

Install • First steps • Usage • Readers • Players • The library file • Contributing


Jukebox is an NFC-powered music player for connected speakers.

  • 💿 Turn NFC tags into albums, playlists, or radio stations
  • 🎵 Supports Spotify, Apple Music, and other music providers
  • 🔊 Currently supports Sonos, with more speaker platforms planned
  • 📡 Currently supports PN532-compatible NFC readers

💡 Inspired by

Install

Install the package from PyPI.

Use pip in a virtual environment.

  1. If your Python version is 3.13 or newer and you want NFC support, install the system GPIO binding:
sudo apt update
sudo apt install python3-lgpio
  1. Create a virtual environment:
# Python < 3.13
python3 -m venv jukebox

# Python >= 3.13 for NFC: use the system Python and include system packages
python3 -m venv --system-site-packages jukebox

source jukebox/bin/activate
  1. Install gukebox into the virtual environment:
pip install "gukebox[pn532,ui]"

Alternative installations

  • pipx can be used with --system-site-packages.
  • uvx / uv tool install are not recommended for NFC on Python 3.13+ because they may select a non-system interpreter.
  • For non-system Python 3.13+, you can still install via pip/uv/poetry/etc. but you must build the lgpio package from source and it may require other system packages.
  • All releases can be downloaded and installed from the GitHub releases page.

Installation for development

For development, read CONTRIBUTING.md.

git clone https://github.com/Gudsfile/jukebox.git
cd jukebox
uv sync

Python Compatibility

Jukebox 1.0+ requires Python 3.11 or newer.

Python version Compatible Jukebox versions Notes
3.7 0.4.0 – 0.4.1 Legacy
3.8 0.4.0 – 0.5.4 Legacy
3.9 – 3.10 0.4.0 – 0.9.0 (incl. 1.0.0.dev13) Legacy
3.11 – 3.12 0.4.0 – latest Actively supported
3.13 0.5.3 – latest Actively supported (see installation notes)

First steps

Initialize the library file with jukebox-admin or manually create it at ~/.config/jukebox/library.json.

Launch the web UI (requires the ui extra):

jukebox-admin ui

Jukebox Admin UI showing the disc library table, with the floating Reader panel reporting an unknown disc on the NFC reader, ready to be added

Add disc form with the Tag ID pre-filled from the reader, and empty fields for URI / Path, artist, album, track, playlist and shuffle

Usage

Start the jukebox with the jukebox command:

jukebox --player PLAYER --reader READER

🎉 With choosing the sonos player and pn532 reader, by approaching a NFC tag stored in the library.json file, you should hear the associated music begins.

Optional Parameters

Parameter Description
--help Show help message.
--player PLAYER Player to use (sonos, dryrun).
--reader READER Reader to use (pn532, dryrun).
--library Path to the library file, default: ~/.config/jukebox/library.json.
--pause-delay SECONDS Grace period before pausing when the NFC tag is removed. Fractional values such as 0.5 or 0.2 are supported, with a minimum of 0.2 seconds to avoid pausing on brief missed reads. Default: 0.25 seconds.
--pause-duration SECONDS Maximum duration of a pause before resetting the queue. Default: 900 seconds (15 minutes).
--verbose Enable verbose logging.
--version Show version.

Readers

Name Description
Dry Run (dryrun) Simulates NFC tag reading via stdin. Input format: tag_id or tag_id duration_seconds.
Pn532 NFC (pn532) Reads physical NFC tags. Works with a PN532 reader and NTAG2xx tags. Requires the pn532 extra and SPI enabled on the Raspberry Pi.

Players

Name Description
Dry Run (dryrun) Displays the events that a real speaker would have performed (playing …, pause, etc.).
Sonos (sonos) SoCo Plays music through a Sonos speaker. Select by IP (--sonos-host), by name (--sonos-name), or let it auto-discover.

Admin CLI

Use jukebox-admin for admin workflows such as settings inspection and the admin API/UI servers.

settings

jukebox-admin settings show
jukebox-admin settings show --effective

api and ui

To use the api and ui commands, additional packages are required. You can install the package[extra] syntax regardless of the package manager you use, for example:

uv tool install gukebox[api]

# ui includes the api extra
uv tool install gukebox[ui]

When running from this repository with uv, include the extra on the command as well:

uv run --extra api jukebox-admin api
uv run --extra ui jukebox-admin ui

library

The library command lets you manage the library through a CLI or an interactive CLI:

jukebox-admin library add tag_id --uri /path/to/media.mp3

or to pull the tag_id currently on the reader:

jukebox-admin library add --from-current --uri /path/to/media.mp3

Other commands are available, use --help to see them.

The library file

The library.json file is a JSON file that maps each NFC tag to what to play. It is used by the jukebox command to find the corresponding metadata for each tag. The jukebox-admin library command helps you manage this file with a CLI, an interactive CLI, an API or a UI (see jukebox-admin --help).

By default, this file should be placed at ~/.config/jukebox/library.json. But you can use another path by creating a JUKEBOX_LIBRARY_PATH environment variable or with the --library argument.

{
  "discs": {
    "a:tag:uid": {
      "uri": "URI of a track, an album or a playlist on many providers",
      "option": { "shuffle": true }
    },
    "another:tag:uid": {
      "uri": "uri"
    },
    …
  }
}

The discs part is a dictionary containing NFC tag UIDs. Each UID is associated with a URI. URIs are the URIs of the music providers (Spotify, Apple Music, etc.) and relate to tracks, albums, playlists, etc.

metadata is an optional section where the names of the artist, album, song, or playlist are entered:

    "a:tag:uid": {
      "uri": "uri",
      "metadata": { "artist": "artist" }
    }

It is also possible to use the shuffle key to play the album in shuffle mode:

    "a:tag:uid": {
      "uri": "uri",
      "option": { "shuffle": true }
    }

To summarize, for example, if you have the following ~/.config/jukebox/library.json file:

{
  "discs": {
    "ta:g1:id": {
      "uri": "uri1",
      "metadata": { "artist": "a", "album": "a" }
    },
    "ta:g2:id": {
      "uri": "uri2",
      "metadata": { "playlist": "b" },
      "option": { "shuffle": true }
    }
  }
}

Then, the jukebox will find the metadata for the tag ta:g2:id and will send the uri2 to the speaker so that it plays playlist "b" in random order.

Contributing

Contributions are welcome! Found a bug, a typo, or something unclear? Open an issue or suggest an edit, with the pencil icon on GitHub or a pull request. See CONTRIBUTING.md.

Metadata

Release files for gukebox 1.10.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gukebox 1.10.0.dev1
File Size Uploaded Provenance Actions
gukebox-1.10.0.dev1.tar.gz 112.3 kB Without provenance Details for gukebox-1.10.0.dev1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gukebox 1.10.0.dev1
File Interpreter ABI Platform Actions
gukebox-1.10.0.dev1-py3-none-any.whl Python 3 none any Details for gukebox-1.10.0.dev1-py3-none-any.whl

Total release size: 257.0 kB

Release files / gukebox-1.10.0.dev1.tar.gz

Download URL gukebox-1.10.0.dev1.tar.gz
Size 112.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d5ee3e70c8616b678c942d50b6e87c85b430af817d5047fc223e2c6c251430e9
BLAKE2b-256 checksum
How to use checksums
1b8aae7e651fc323b50fa00af38729f745d410a82de3db506eb467bcbc92debe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gukebox-1.10.0.dev1-py3-none-any.whl

Download URL gukebox-1.10.0.dev1-py3-none-any.whl
Size 144.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7aac82e1074e843b2aeb1d4f876d3f122e7c7c7b133e38ea4252350f23753b81
BLAKE2b-256 checksum
How to use checksums
91f5dc871b61220ce52e6d00f6ce078360f54cbdb26c34d0410bb32291189532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gukebox 1.10.0.dev1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page