Python client for the Lexicon DJ API
Project description
lexicon-python
A lightweight Python client for the Lexicon DJ API. It wraps the REST endpoints used for playlist browsing and track lookups, while staying simple enough to embed inside scripts or larger automation projects.
Features
- Class
LexiconClientwith configurable host/port. - All GET requests for Playlists, Tracks, and Tags available
- Handy helpers:
- Interactive
choose_playlistprompt for fast CLI workflows. - GET for all tracks can automatically retrieve all pages with
get_all - Batch function
get_track_batchcan retrieve full metadata for a list of tracks (including progress bar for large retrievals)
- Interactive
- Minimal dependencies (
requests,tqdm) and a pure-Python implementation suitable for scripts or larger apps.
Quickstart
-
Create a virtual environment and install requirements:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
-
Run the example script (ensure your Lexicon instance is reachable):
python examples/demo_lexicon.pyThe script prompts you to choose a playlist, then fetches metadata for the first five tracks.
Usage
from lexicon import LexiconClient
lexicon = LexiconClient()
# Choose playlist interactively and fetch it's tracks
selection = lexicon.choose_playlist(show_counts=True)
if selection:
path, playlist = selection
print("Selected:", " / ".join(path))
track_ids = set(playlist.get("trackIds", []))
print("Tracks reported: ", len(track_ids))
tracks = lexicon.get_track_batch(track_ids, max_workers=5)
for track in tracks:
print(track["title"], "-", track["artist"])
else:
print("No playlist selected.")
# Fetch the complete library in chunks of 250
tracks = lexicon.get_tracks(limit=250, get_all=True) or []
print(f"Fetched {len(tracks)} tracks")
# Search within your library
results = lexicon.search_tracks({"artist": "Daft Punk", "bpm": ">=120"}) or []
print(f"Found {len(results)} matching tracks")
# Inspect tags and categories
tags_payload = lexicon.get_tags()
if tags_payload:
for category in tags_payload["categories"]:
print("Category:", category["label"])
for tag_id in category["tags"]:
tag = next((t for t in tags_payload["tags"] if t["id"] == tag_id), None)
print("->", tag["label"])
See examples/demo_lexicon.py for a more complete walkthrough.
Development
- Run the test suite:
PYTHONPATH=src python -m unittest discover -s tests - Style: keep the package pure Python, logging via
logging.getLogger(__name__), and prefer small, testable helpers. - Packaging metadata lives in
pyproject.toml(see below).
Contributions welcome—open an issue or PR with ideas!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lexicon_python-0.1.0.tar.gz.
File metadata
- Download URL: lexicon_python-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e55e8ca81ac1dbbe2f47476b46b3ce55baadf6d04e4ebc91dd060c7e03d2cc9
|
|
| MD5 |
8811f2a4af2e4c615c5870966d0a9188
|
|
| BLAKE2b-256 |
881b1f36752f4e16cf8d2e52bdaa93180f598fb7cc339bdbb963cced5d0d5a1d
|
File details
Details for the file lexicon_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lexicon_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
401cb23245705b313b98b1b45c49f1934a70ec4b6b1c801c123e9148ee6c8c69
|
|
| MD5 |
4637d212d7af22ba2542c62914143c18
|
|
| BLAKE2b-256 |
4acd7f0d5432f404915ac40e6f4aff0f2c6951a4e9f7fb419d7243bd26d50616
|