lexicon-python 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lexicon_python-0.1.0/LICENSE +21 -0
- lexicon_python-0.1.0/PKG-INFO +95 -0
- lexicon_python-0.1.0/README.md +81 -0
- lexicon_python-0.1.0/pyproject.toml +28 -0
- lexicon_python-0.1.0/setup.cfg +4 -0
- lexicon_python-0.1.0/src/lexicon/__init__.py +5 -0
- lexicon_python-0.1.0/src/lexicon/lexicon.py +691 -0
- lexicon_python-0.1.0/src/lexicon_python.egg-info/PKG-INFO +95 -0
- lexicon_python-0.1.0/src/lexicon_python.egg-info/SOURCES.txt +11 -0
- lexicon_python-0.1.0/src/lexicon_python.egg-info/dependency_links.txt +1 -0
- lexicon_python-0.1.0/src/lexicon_python.egg-info/requires.txt +2 -0
- lexicon_python-0.1.0/src/lexicon_python.egg-info/top_level.txt +1 -0
- lexicon_python-0.1.0/tests/test_lexicon.py +509 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Garrison Burger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lexicon-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Lexicon DJ API
|
|
5
|
+
Author-email: Garrison Burger <burgerga123@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/photonicvelocity/lexicon-python
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: requests>=2.31
|
|
12
|
+
Requires-Dist: tqdm>=4.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# lexicon-python
|
|
16
|
+
|
|
17
|
+
A lightweight Python client for the [Lexicon DJ](https://www.lexicondj.com/) 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.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Class `LexiconClient` with configurable host/port.
|
|
22
|
+
- All GET requests for Playlists, Tracks, and Tags available
|
|
23
|
+
- Handy helpers:
|
|
24
|
+
- Interactive `choose_playlist` prompt for fast CLI workflows.
|
|
25
|
+
- GET for all tracks can automatically retrieve all pages with `get_all`
|
|
26
|
+
- Batch function `get_track_batch` can retrieve full metadata for a list of tracks (including progress bar
|
|
27
|
+
for large retrievals)
|
|
28
|
+
- Minimal dependencies (`requests`, `tqdm`) and a pure-Python implementation suitable for scripts or larger apps.
|
|
29
|
+
|
|
30
|
+
## Quickstart
|
|
31
|
+
|
|
32
|
+
1. Create a virtual environment and install requirements:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python3 -m venv .venv
|
|
36
|
+
source .venv/bin/activate
|
|
37
|
+
pip install -r requirements.txt
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. Run the example script (ensure your Lexicon instance is reachable):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python examples/demo_lexicon.py
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The script prompts you to choose a playlist, then fetches metadata for the first five tracks.
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from lexicon import LexiconClient
|
|
52
|
+
|
|
53
|
+
lexicon = LexiconClient()
|
|
54
|
+
|
|
55
|
+
# Choose playlist interactively and fetch it's tracks
|
|
56
|
+
selection = lexicon.choose_playlist(show_counts=True)
|
|
57
|
+
if selection:
|
|
58
|
+
path, playlist = selection
|
|
59
|
+
print("Selected:", " / ".join(path))
|
|
60
|
+
track_ids = set(playlist.get("trackIds", []))
|
|
61
|
+
print("Tracks reported: ", len(track_ids))
|
|
62
|
+
|
|
63
|
+
tracks = lexicon.get_track_batch(track_ids, max_workers=5)
|
|
64
|
+
for track in tracks:
|
|
65
|
+
print(track["title"], "-", track["artist"])
|
|
66
|
+
else:
|
|
67
|
+
print("No playlist selected.")
|
|
68
|
+
|
|
69
|
+
# Fetch the complete library in chunks of 250
|
|
70
|
+
tracks = lexicon.get_tracks(limit=250, get_all=True) or []
|
|
71
|
+
print(f"Fetched {len(tracks)} tracks")
|
|
72
|
+
|
|
73
|
+
# Search within your library
|
|
74
|
+
results = lexicon.search_tracks({"artist": "Daft Punk", "bpm": ">=120"}) or []
|
|
75
|
+
print(f"Found {len(results)} matching tracks")
|
|
76
|
+
|
|
77
|
+
# Inspect tags and categories
|
|
78
|
+
tags_payload = lexicon.get_tags()
|
|
79
|
+
if tags_payload:
|
|
80
|
+
for category in tags_payload["categories"]:
|
|
81
|
+
print("Category:", category["label"])
|
|
82
|
+
for tag_id in category["tags"]:
|
|
83
|
+
tag = next((t for t in tags_payload["tags"] if t["id"] == tag_id), None)
|
|
84
|
+
print("->", tag["label"])
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See `examples/demo_lexicon.py` for a more complete walkthrough.
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
- Run the test suite: `PYTHONPATH=src python -m unittest discover -s tests`
|
|
92
|
+
- Style: keep the package pure Python, logging via `logging.getLogger(__name__)`, and prefer small, testable helpers.
|
|
93
|
+
- Packaging metadata lives in `pyproject.toml` (see below).
|
|
94
|
+
|
|
95
|
+
Contributions welcome—open an issue or PR with ideas!
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# lexicon-python
|
|
2
|
+
|
|
3
|
+
A lightweight Python client for the [Lexicon DJ](https://www.lexicondj.com/) 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.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Class `LexiconClient` with configurable host/port.
|
|
8
|
+
- All GET requests for Playlists, Tracks, and Tags available
|
|
9
|
+
- Handy helpers:
|
|
10
|
+
- Interactive `choose_playlist` prompt for fast CLI workflows.
|
|
11
|
+
- GET for all tracks can automatically retrieve all pages with `get_all`
|
|
12
|
+
- Batch function `get_track_batch` can retrieve full metadata for a list of tracks (including progress bar
|
|
13
|
+
for large retrievals)
|
|
14
|
+
- Minimal dependencies (`requests`, `tqdm`) and a pure-Python implementation suitable for scripts or larger apps.
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
|
|
18
|
+
1. Create a virtual environment and install requirements:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python3 -m venv .venv
|
|
22
|
+
source .venv/bin/activate
|
|
23
|
+
pip install -r requirements.txt
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. Run the example script (ensure your Lexicon instance is reachable):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python examples/demo_lexicon.py
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The script prompts you to choose a playlist, then fetches metadata for the first five tracks.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from lexicon import LexiconClient
|
|
38
|
+
|
|
39
|
+
lexicon = LexiconClient()
|
|
40
|
+
|
|
41
|
+
# Choose playlist interactively and fetch it's tracks
|
|
42
|
+
selection = lexicon.choose_playlist(show_counts=True)
|
|
43
|
+
if selection:
|
|
44
|
+
path, playlist = selection
|
|
45
|
+
print("Selected:", " / ".join(path))
|
|
46
|
+
track_ids = set(playlist.get("trackIds", []))
|
|
47
|
+
print("Tracks reported: ", len(track_ids))
|
|
48
|
+
|
|
49
|
+
tracks = lexicon.get_track_batch(track_ids, max_workers=5)
|
|
50
|
+
for track in tracks:
|
|
51
|
+
print(track["title"], "-", track["artist"])
|
|
52
|
+
else:
|
|
53
|
+
print("No playlist selected.")
|
|
54
|
+
|
|
55
|
+
# Fetch the complete library in chunks of 250
|
|
56
|
+
tracks = lexicon.get_tracks(limit=250, get_all=True) or []
|
|
57
|
+
print(f"Fetched {len(tracks)} tracks")
|
|
58
|
+
|
|
59
|
+
# Search within your library
|
|
60
|
+
results = lexicon.search_tracks({"artist": "Daft Punk", "bpm": ">=120"}) or []
|
|
61
|
+
print(f"Found {len(results)} matching tracks")
|
|
62
|
+
|
|
63
|
+
# Inspect tags and categories
|
|
64
|
+
tags_payload = lexicon.get_tags()
|
|
65
|
+
if tags_payload:
|
|
66
|
+
for category in tags_payload["categories"]:
|
|
67
|
+
print("Category:", category["label"])
|
|
68
|
+
for tag_id in category["tags"]:
|
|
69
|
+
tag = next((t for t in tags_payload["tags"] if t["id"] == tag_id), None)
|
|
70
|
+
print("->", tag["label"])
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See `examples/demo_lexicon.py` for a more complete walkthrough.
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
- Run the test suite: `PYTHONPATH=src python -m unittest discover -s tests`
|
|
78
|
+
- Style: keep the package pure Python, logging via `logging.getLogger(__name__)`, and prefer small, testable helpers.
|
|
79
|
+
- Packaging metadata lives in `pyproject.toml` (see below).
|
|
80
|
+
|
|
81
|
+
Contributions welcome—open an issue or PR with ideas!
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "lexicon-python"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the Lexicon DJ API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Garrison Burger", email = "burgerga123@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"requests>=2.31",
|
|
18
|
+
"tqdm>=4.0"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/photonicvelocity/lexicon-python"
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["src"]
|
|
26
|
+
|
|
27
|
+
[tool.setuptools]
|
|
28
|
+
package-dir = {"" = "src"}
|