Mopidy-JukeboxLights 1.0.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.
- mopidy_jukeboxlights-1.0.0/.github/workflows/ci.yml +203 -0
- mopidy_jukeboxlights-1.0.0/.gitignore +10 -0
- mopidy_jukeboxlights-1.0.0/LICENSE +21 -0
- mopidy_jukeboxlights-1.0.0/PKG-INFO +104 -0
- mopidy_jukeboxlights-1.0.0/README.md +73 -0
- mopidy_jukeboxlights-1.0.0/pyproject.toml +61 -0
- mopidy_jukeboxlights-1.0.0/setup.cfg +4 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/PKG-INFO +104 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/SOURCES.txt +22 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/dependency_links.txt +1 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/entry_points.txt +2 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/requires.txt +8 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/scm_file_list.json +18 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/scm_version.json +8 -0
- mopidy_jukeboxlights-1.0.0/src/Mopidy_JukeboxLights.egg-info/top_level.txt +1 -0
- mopidy_jukeboxlights-1.0.0/src/mopidy_jukebox_lights/__init__.py +52 -0
- mopidy_jukeboxlights-1.0.0/src/mopidy_jukebox_lights/color.py +85 -0
- mopidy_jukeboxlights-1.0.0/src/mopidy_jukebox_lights/ext.conf +9 -0
- mopidy_jukeboxlights-1.0.0/src/mopidy_jukebox_lights/frontend.py +320 -0
- mopidy_jukeboxlights-1.0.0/src/mopidy_jukebox_lights/web.py +240 -0
- mopidy_jukeboxlights-1.0.0/tests/test_color.py +84 -0
- mopidy_jukeboxlights-1.0.0/tests/test_extension.py +38 -0
- mopidy_jukeboxlights-1.0.0/tests/test_frontend.py +147 -0
- mopidy_jukeboxlights-1.0.0/tests/test_web.py +174 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
tags: ["v*"]
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
publish_testpypi:
|
|
11
|
+
description: "Upload this build to TestPyPI"
|
|
12
|
+
type: boolean
|
|
13
|
+
default: false
|
|
14
|
+
|
|
15
|
+
# Mopidy 3 and Mopidy 4 need different environments and neither runner image
|
|
16
|
+
# can host both:
|
|
17
|
+
# * Mopidy 4 declares requires-python >=3.13 AND needs GStreamer >= 1.26.2.
|
|
18
|
+
# * ubuntu-latest (24.04) ships GStreamer 1.24.2, so Mopidy 4 cannot run there.
|
|
19
|
+
# * debian:trixie ships 1.26.2 -- and is the platform this actually deploys to.
|
|
20
|
+
# So: Mopidy 3 on the hosted runner, Mopidy 4 in a trixie container.
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
mopidy3:
|
|
24
|
+
name: "Mopidy 3 · Python ${{ matrix.python }}"
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
strategy:
|
|
27
|
+
fail-fast: false
|
|
28
|
+
matrix:
|
|
29
|
+
python: ["3.11", "3.12"]
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v6
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 0 # setuptools-scm derives the version from tags
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-python@v6
|
|
36
|
+
with:
|
|
37
|
+
python-version: ${{ matrix.python }}
|
|
38
|
+
cache: pip
|
|
39
|
+
|
|
40
|
+
# apt's python3-gi installs into the *system* interpreter's
|
|
41
|
+
# dist-packages, which the setup-python interpreter cannot see. So the
|
|
42
|
+
# Python binding comes from pip; apt supplies the C libraries, the build
|
|
43
|
+
# headers, and the GObject typelibs read at runtime.
|
|
44
|
+
- name: Install GStreamer libraries and headers
|
|
45
|
+
run: |
|
|
46
|
+
sudo apt-get update -qq
|
|
47
|
+
sudo apt-get install -y --no-install-recommends \
|
|
48
|
+
pkg-config python3-dev \
|
|
49
|
+
libgirepository1.0-dev libcairo2-dev \
|
|
50
|
+
libglib2.0-dev libgstreamer1.0-dev \
|
|
51
|
+
gir1.2-glib-2.0 gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0
|
|
52
|
+
|
|
53
|
+
- name: Install
|
|
54
|
+
run: |
|
|
55
|
+
python -m pip install --upgrade pip
|
|
56
|
+
# pygobject 3.52+ needs girepository-2.0, absent on Ubuntu 24.04.
|
|
57
|
+
# Mopidy 3 imports pkg_resources, removed in setuptools 81.
|
|
58
|
+
pip install "pygobject<3.52" "setuptools<81"
|
|
59
|
+
pip install -e ".[test]"
|
|
60
|
+
|
|
61
|
+
- name: Sanity check the bindings
|
|
62
|
+
run: |
|
|
63
|
+
python -c "import gi; gi.require_version('Gst','1.0'); from gi.repository import Gst; print('pygobject', gi.__version__)"
|
|
64
|
+
python -c "from mopidy.core import CoreListener; print('mopidy.core OK')"
|
|
65
|
+
|
|
66
|
+
- name: Test
|
|
67
|
+
run: pytest -q --cov --cov-report=term-missing
|
|
68
|
+
|
|
69
|
+
mopidy4:
|
|
70
|
+
name: "Mopidy 4 · Debian trixie"
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
container: debian:trixie
|
|
73
|
+
steps:
|
|
74
|
+
# git must exist before checkout, otherwise the action falls back to a
|
|
75
|
+
# tarball download with no .git directory and setuptools-scm cannot
|
|
76
|
+
# derive a version.
|
|
77
|
+
- name: Install git
|
|
78
|
+
run: |
|
|
79
|
+
apt-get update -qq
|
|
80
|
+
apt-get install -y -qq --no-install-recommends git ca-certificates
|
|
81
|
+
|
|
82
|
+
- uses: actions/checkout@v6
|
|
83
|
+
with:
|
|
84
|
+
fetch-depth: 0
|
|
85
|
+
|
|
86
|
+
- name: Trust the workspace
|
|
87
|
+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
88
|
+
|
|
89
|
+
- name: Install dependencies
|
|
90
|
+
run: |
|
|
91
|
+
apt-get install -y -qq --no-install-recommends \
|
|
92
|
+
python3 python3-pip python3-venv python3-gi python3-gi-cairo \
|
|
93
|
+
gir1.2-glib-2.0 gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 \
|
|
94
|
+
gstreamer1.0-plugins-base
|
|
95
|
+
# --system-site-packages so the venv can see apt's python3-gi, which
|
|
96
|
+
# is not sensibly pip-installable. Same arrangement the jukebox uses.
|
|
97
|
+
python3 -m venv --system-site-packages /tmp/venv
|
|
98
|
+
/tmp/venv/bin/pip install --quiet --upgrade pip
|
|
99
|
+
/tmp/venv/bin/pip install -e ".[test]"
|
|
100
|
+
|
|
101
|
+
- name: Show what we are testing against
|
|
102
|
+
run: |
|
|
103
|
+
/tmp/venv/bin/python -c "import mopidy; print('mopidy', mopidy.__version__)"
|
|
104
|
+
gst-inspect-1.0 --version | head -2 || true
|
|
105
|
+
|
|
106
|
+
- name: Test
|
|
107
|
+
run: /tmp/venv/bin/pytest -q --cov --cov-report=term-missing
|
|
108
|
+
|
|
109
|
+
build:
|
|
110
|
+
needs: [mopidy3, mopidy4]
|
|
111
|
+
runs-on: ubuntu-latest
|
|
112
|
+
outputs:
|
|
113
|
+
# Distinguishes a real release tag from a release candidate. Without
|
|
114
|
+
# this, 'refs/tags/v...' matches v1.0.0rc1 exactly as well as v1.0.0 and
|
|
115
|
+
# a candidate goes straight to the real index.
|
|
116
|
+
prerelease: ${{ steps.classify.outputs.prerelease }}
|
|
117
|
+
steps:
|
|
118
|
+
- uses: actions/checkout@v6
|
|
119
|
+
with:
|
|
120
|
+
fetch-depth: 0
|
|
121
|
+
- uses: actions/setup-python@v6
|
|
122
|
+
with:
|
|
123
|
+
python-version: "3.12"
|
|
124
|
+
- run: pip install build twine trove-classifiers
|
|
125
|
+
|
|
126
|
+
# twine check does NOT validate classifiers; PyPI rejects an unknown one
|
|
127
|
+
# with a 400 at upload time, after the whole pipeline has run. Catch it
|
|
128
|
+
# here instead. (There is no "Framework :: Mopidy" classifier, however
|
|
129
|
+
# much it feels like there should be.)
|
|
130
|
+
- name: Validate classifiers
|
|
131
|
+
run: |
|
|
132
|
+
python - <<'EOF'
|
|
133
|
+
import sys, tomllib
|
|
134
|
+
from trove_classifiers import classifiers as valid
|
|
135
|
+
declared = tomllib.load(open("pyproject.toml","rb"))["project"].get("classifiers", [])
|
|
136
|
+
bad = [c for c in declared if c not in valid]
|
|
137
|
+
for c in declared:
|
|
138
|
+
print((" ok " if c in valid else " INVALID ") + c)
|
|
139
|
+
if bad:
|
|
140
|
+
sys.exit(f"\nNot valid trove classifiers: {bad}")
|
|
141
|
+
EOF
|
|
142
|
+
|
|
143
|
+
- run: python -m build # pure-python wheel; no GStreamer needed
|
|
144
|
+
- run: twine check dist/*
|
|
145
|
+
|
|
146
|
+
- name: Is this a final release tag?
|
|
147
|
+
id: classify
|
|
148
|
+
run: |
|
|
149
|
+
if [[ "${GITHUB_REF_TYPE}" == "tag" && \
|
|
150
|
+
"${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(\.post[0-9]+)?$ ]]; then
|
|
151
|
+
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
|
152
|
+
echo "::notice::${GITHUB_REF_NAME} is a final release -> PyPI"
|
|
153
|
+
else
|
|
154
|
+
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
|
155
|
+
echo "::notice::${GITHUB_REF_NAME} is not a final release -> TestPyPI"
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
- uses: actions/upload-artifact@v6
|
|
159
|
+
with:
|
|
160
|
+
name: dist
|
|
161
|
+
path: dist/
|
|
162
|
+
|
|
163
|
+
# TestPyPI on every push to main, and on demand from the Actions tab. Gives
|
|
164
|
+
# you a real 'pip install -i https://test.pypi.org/simple/' rehearsal before
|
|
165
|
+
# anything reaches the real index. Versions are 1.0.1.devN, derived from
|
|
166
|
+
# commit distance, so each push is unique; skip-existing covers re-runs.
|
|
167
|
+
publish-testpypi:
|
|
168
|
+
if: >-
|
|
169
|
+
github.ref == 'refs/heads/main' ||
|
|
170
|
+
(github.ref_type == 'tag' && needs.build.outputs.prerelease == 'true') ||
|
|
171
|
+
(github.event_name == 'workflow_dispatch' && inputs.publish_testpypi)
|
|
172
|
+
needs: build
|
|
173
|
+
runs-on: ubuntu-latest
|
|
174
|
+
environment: testpypi
|
|
175
|
+
permissions:
|
|
176
|
+
id-token: write
|
|
177
|
+
steps:
|
|
178
|
+
- uses: actions/download-artifact@v6
|
|
179
|
+
with:
|
|
180
|
+
name: dist
|
|
181
|
+
path: dist/
|
|
182
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
183
|
+
with:
|
|
184
|
+
repository-url: https://test.pypi.org/legacy/
|
|
185
|
+
skip-existing: true
|
|
186
|
+
|
|
187
|
+
publish:
|
|
188
|
+
# The real index, and ONLY for a final release tag. A candidate such as
|
|
189
|
+
# v1.0.0rc1 routes to TestPyPI instead -- PyPI never lets a version number
|
|
190
|
+
# be reused, so an accidental upload there is permanent.
|
|
191
|
+
# Trusted Publishing (OIDC) -- no API token stored anywhere.
|
|
192
|
+
if: github.ref_type == 'tag' && needs.build.outputs.prerelease == 'false'
|
|
193
|
+
needs: build
|
|
194
|
+
runs-on: ubuntu-latest
|
|
195
|
+
environment: pypi
|
|
196
|
+
permissions:
|
|
197
|
+
id-token: write
|
|
198
|
+
steps:
|
|
199
|
+
- uses: actions/download-artifact@v6
|
|
200
|
+
with:
|
|
201
|
+
name: dist
|
|
202
|
+
path: dist/
|
|
203
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 King Butter
|
|
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,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Mopidy-JukeboxLights
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Drive WLED LED strips from Mopidy album art
|
|
5
|
+
Author: King Butter
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kingbutter/mopidy-jukebox-lights
|
|
8
|
+
Project-URL: Issues, https://github.com/kingbutter/mopidy-jukebox-lights/issues
|
|
9
|
+
Project-URL: Source, https://github.com/kingbutter/mopidy-jukebox-lights
|
|
10
|
+
Keywords: mopidy,mopidy-extension,music,wled,led,esp32,lighting
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: No Input/Output (Daemon)
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: Mopidy>=3.4
|
|
24
|
+
Requires-Dist: Pykka>=3.0
|
|
25
|
+
Requires-Dist: Pillow>=9.0
|
|
26
|
+
Requires-Dist: tornado>=6.0
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Mopidy-JukeboxLights
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/Mopidy-JukeboxLights/)
|
|
35
|
+
[](https://github.com/kingbutter/mopidy-jukebox-lights/actions)
|
|
36
|
+
|
|
37
|
+
A [Mopidy](https://mopidy.com/) extension that drives
|
|
38
|
+
[WLED](https://kno.wled.ge/) LED strips with colors pulled from the album art
|
|
39
|
+
of whatever is playing.
|
|
40
|
+
|
|
41
|
+
## What it does
|
|
42
|
+
|
|
43
|
+
- **Color from the sleeve.** Averaging album art gives brown every time.
|
|
44
|
+
Instead this buckets pixels, discards anything too dark or too washed out to
|
|
45
|
+
register as light, and scores the rest by pixel count weighted by
|
|
46
|
+
saturation — so a small bright detail on a black sleeve still wins.
|
|
47
|
+
- **Two-color cabinets.** Picks an accent from the strongest hue at least
|
|
48
|
+
~29° away from the dominant, and paints nominated segments with it. A
|
|
49
|
+
red-and-blue sleeve lights red and blue, not two shades of purple.
|
|
50
|
+
- **Event driven.** A Mopidy frontend actor listening for
|
|
51
|
+
`track_playback_started`, so the lights change the instant the track does.
|
|
52
|
+
Network calls run on a worker thread and never block Mopidy's event loop.
|
|
53
|
+
- **Idle and dark states.** Breathes amber when nothing is playing, and goes
|
|
54
|
+
fully dark when a kiosk panel blanks — see `follow_display` below.
|
|
55
|
+
|
|
56
|
+
## Status page
|
|
57
|
+
|
|
58
|
+
Once running, `http://<your-host>:6680/jukeboxlights/` shows what the lights
|
|
59
|
+
are doing and, more usefully, *why* — whether WLED is reachable, which
|
|
60
|
+
segments were discovered, and whether the strip is following music, breathing
|
|
61
|
+
amber, or dark because the kiosk panel blanked. It also has a button to cycle
|
|
62
|
+
red/green/blue/amber for checking wiring without needing to play anything.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
python3 -m pip install Mopidy-JukeboxLights
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
```ini
|
|
73
|
+
[jukeboxlights]
|
|
74
|
+
enabled = true
|
|
75
|
+
wled_host = 172.20.25.44 # IP or host:port of your WLED device
|
|
76
|
+
brightness = 160 # 1-255
|
|
77
|
+
idle_after = 45 # seconds of silence before the idle effect
|
|
78
|
+
idle_color = 240,168,48 # amber
|
|
79
|
+
accent_segments = 1,2,3 # segment ids that get the accent color
|
|
80
|
+
follow_display = true
|
|
81
|
+
display_flag = /run/jukebox/display-off
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Segments are read from WLED at startup, so a strip run in one uncut piece with
|
|
85
|
+
hidden stretches behind a door frame works without any config here — define
|
|
86
|
+
the visible runs as WLED segments and this follows them.
|
|
87
|
+
|
|
88
|
+
### Turning the lights off with the screen
|
|
89
|
+
|
|
90
|
+
If something else on the machine creates the file named by `display_flag` when
|
|
91
|
+
a kiosk display blanks, the strip goes fully dark rather than breathing — but
|
|
92
|
+
only while nothing is playing. Remove the file and it comes back. Set
|
|
93
|
+
`follow_display = false` to ignore this entirely.
|
|
94
|
+
|
|
95
|
+
## Project resources
|
|
96
|
+
|
|
97
|
+
- [Source code](https://github.com/kingbutter/mopidy-jukebox-lights)
|
|
98
|
+
- [Issue tracker](https://github.com/kingbutter/mopidy-jukebox-lights/issues)
|
|
99
|
+
|
|
100
|
+
## Credits
|
|
101
|
+
|
|
102
|
+
- Original author: [King Butter](https://github.com/kingbutter)
|
|
103
|
+
- Current maintainer: [King Butter](https://github.com/kingbutter)
|
|
104
|
+
x
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Mopidy-JukeboxLights
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/Mopidy-JukeboxLights/)
|
|
4
|
+
[](https://github.com/kingbutter/mopidy-jukebox-lights/actions)
|
|
5
|
+
|
|
6
|
+
A [Mopidy](https://mopidy.com/) extension that drives
|
|
7
|
+
[WLED](https://kno.wled.ge/) LED strips with colors pulled from the album art
|
|
8
|
+
of whatever is playing.
|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
- **Color from the sleeve.** Averaging album art gives brown every time.
|
|
13
|
+
Instead this buckets pixels, discards anything too dark or too washed out to
|
|
14
|
+
register as light, and scores the rest by pixel count weighted by
|
|
15
|
+
saturation — so a small bright detail on a black sleeve still wins.
|
|
16
|
+
- **Two-color cabinets.** Picks an accent from the strongest hue at least
|
|
17
|
+
~29° away from the dominant, and paints nominated segments with it. A
|
|
18
|
+
red-and-blue sleeve lights red and blue, not two shades of purple.
|
|
19
|
+
- **Event driven.** A Mopidy frontend actor listening for
|
|
20
|
+
`track_playback_started`, so the lights change the instant the track does.
|
|
21
|
+
Network calls run on a worker thread and never block Mopidy's event loop.
|
|
22
|
+
- **Idle and dark states.** Breathes amber when nothing is playing, and goes
|
|
23
|
+
fully dark when a kiosk panel blanks — see `follow_display` below.
|
|
24
|
+
|
|
25
|
+
## Status page
|
|
26
|
+
|
|
27
|
+
Once running, `http://<your-host>:6680/jukeboxlights/` shows what the lights
|
|
28
|
+
are doing and, more usefully, *why* — whether WLED is reachable, which
|
|
29
|
+
segments were discovered, and whether the strip is following music, breathing
|
|
30
|
+
amber, or dark because the kiosk panel blanked. It also has a button to cycle
|
|
31
|
+
red/green/blue/amber for checking wiring without needing to play anything.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
python3 -m pip install Mopidy-JukeboxLights
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
```ini
|
|
42
|
+
[jukeboxlights]
|
|
43
|
+
enabled = true
|
|
44
|
+
wled_host = 172.20.25.44 # IP or host:port of your WLED device
|
|
45
|
+
brightness = 160 # 1-255
|
|
46
|
+
idle_after = 45 # seconds of silence before the idle effect
|
|
47
|
+
idle_color = 240,168,48 # amber
|
|
48
|
+
accent_segments = 1,2,3 # segment ids that get the accent color
|
|
49
|
+
follow_display = true
|
|
50
|
+
display_flag = /run/jukebox/display-off
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Segments are read from WLED at startup, so a strip run in one uncut piece with
|
|
54
|
+
hidden stretches behind a door frame works without any config here — define
|
|
55
|
+
the visible runs as WLED segments and this follows them.
|
|
56
|
+
|
|
57
|
+
### Turning the lights off with the screen
|
|
58
|
+
|
|
59
|
+
If something else on the machine creates the file named by `display_flag` when
|
|
60
|
+
a kiosk display blanks, the strip goes fully dark rather than breathing — but
|
|
61
|
+
only while nothing is playing. Remove the file and it comes back. Set
|
|
62
|
+
`follow_display = false` to ignore this entirely.
|
|
63
|
+
|
|
64
|
+
## Project resources
|
|
65
|
+
|
|
66
|
+
- [Source code](https://github.com/kingbutter/mopidy-jukebox-lights)
|
|
67
|
+
- [Issue tracker](https://github.com/kingbutter/mopidy-jukebox-lights/issues)
|
|
68
|
+
|
|
69
|
+
## Credits
|
|
70
|
+
|
|
71
|
+
- Original author: [King Butter](https://github.com/kingbutter)
|
|
72
|
+
- Current maintainer: [King Butter](https://github.com/kingbutter)
|
|
73
|
+
x
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "setuptools-scm>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "Mopidy-JukeboxLights"
|
|
7
|
+
description = "Drive WLED LED strips from Mopidy album art"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "King Butter" }]
|
|
13
|
+
keywords = ["mopidy", "mopidy-extension", "music", "wled", "led", "esp32", "lighting"]
|
|
14
|
+
dynamic = ["version"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
# NB: there is no "Framework :: Mopidy" classifier -- PyPI validates
|
|
17
|
+
# against the official trove list and rejects the upload with a 400 if you
|
|
18
|
+
# invent one. Mopidy's registry finds extensions by the distribution name
|
|
19
|
+
# containing "Mopidy" plus the mopidy.ext entry point, not by classifier.
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Environment :: No Input/Output (Daemon)",
|
|
22
|
+
"Intended Audience :: End Users/Desktop",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Multimedia :: Sound/Audio :: Players",
|
|
29
|
+
]
|
|
30
|
+
dependencies = ["Mopidy>=3.4", "Pykka>=3.0", "Pillow>=9.0", "tornado>=6.0"]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
test = ["pytest>=8", "pytest-cov"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/kingbutter/mopidy-jukebox-lights"
|
|
37
|
+
Issues = "https://github.com/kingbutter/mopidy-jukebox-lights/issues"
|
|
38
|
+
Source = "https://github.com/kingbutter/mopidy-jukebox-lights"
|
|
39
|
+
|
|
40
|
+
[project.entry-points."mopidy.ext"]
|
|
41
|
+
jukeboxlights = "mopidy_jukebox_lights:Extension"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools_scm]
|
|
44
|
+
# Version comes from the git tag, so a release is 'git tag v1.0.1 && push'.
|
|
45
|
+
# Nothing to bump by hand, nothing to get out of sync with PyPI.
|
|
46
|
+
#
|
|
47
|
+
# no-local-version matters for TestPyPI: the default scheme appends a local
|
|
48
|
+
# identifier (1.0.1.dev4+g3f3dafd) and PyPI rejects any version carrying one.
|
|
49
|
+
# Without this, every untagged upload fails. Untagged builds become
|
|
50
|
+
# 1.0.1.dev4, which sorts *before* 1.0.1 -- correct for a pre-release.
|
|
51
|
+
local_scheme = "no-local-version"
|
|
52
|
+
fallback_version = "0.0.0" # building from an sdist with no git history
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.packages.find]
|
|
55
|
+
where = ["src"]
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.package-data]
|
|
58
|
+
"*" = ["ext.conf", "static/*"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Mopidy-JukeboxLights
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Drive WLED LED strips from Mopidy album art
|
|
5
|
+
Author: King Butter
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kingbutter/mopidy-jukebox-lights
|
|
8
|
+
Project-URL: Issues, https://github.com/kingbutter/mopidy-jukebox-lights/issues
|
|
9
|
+
Project-URL: Source, https://github.com/kingbutter/mopidy-jukebox-lights
|
|
10
|
+
Keywords: mopidy,mopidy-extension,music,wled,led,esp32,lighting
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: No Input/Output (Daemon)
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: Mopidy>=3.4
|
|
24
|
+
Requires-Dist: Pykka>=3.0
|
|
25
|
+
Requires-Dist: Pillow>=9.0
|
|
26
|
+
Requires-Dist: tornado>=6.0
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Mopidy-JukeboxLights
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/Mopidy-JukeboxLights/)
|
|
35
|
+
[](https://github.com/kingbutter/mopidy-jukebox-lights/actions)
|
|
36
|
+
|
|
37
|
+
A [Mopidy](https://mopidy.com/) extension that drives
|
|
38
|
+
[WLED](https://kno.wled.ge/) LED strips with colors pulled from the album art
|
|
39
|
+
of whatever is playing.
|
|
40
|
+
|
|
41
|
+
## What it does
|
|
42
|
+
|
|
43
|
+
- **Color from the sleeve.** Averaging album art gives brown every time.
|
|
44
|
+
Instead this buckets pixels, discards anything too dark or too washed out to
|
|
45
|
+
register as light, and scores the rest by pixel count weighted by
|
|
46
|
+
saturation — so a small bright detail on a black sleeve still wins.
|
|
47
|
+
- **Two-color cabinets.** Picks an accent from the strongest hue at least
|
|
48
|
+
~29° away from the dominant, and paints nominated segments with it. A
|
|
49
|
+
red-and-blue sleeve lights red and blue, not two shades of purple.
|
|
50
|
+
- **Event driven.** A Mopidy frontend actor listening for
|
|
51
|
+
`track_playback_started`, so the lights change the instant the track does.
|
|
52
|
+
Network calls run on a worker thread and never block Mopidy's event loop.
|
|
53
|
+
- **Idle and dark states.** Breathes amber when nothing is playing, and goes
|
|
54
|
+
fully dark when a kiosk panel blanks — see `follow_display` below.
|
|
55
|
+
|
|
56
|
+
## Status page
|
|
57
|
+
|
|
58
|
+
Once running, `http://<your-host>:6680/jukeboxlights/` shows what the lights
|
|
59
|
+
are doing and, more usefully, *why* — whether WLED is reachable, which
|
|
60
|
+
segments were discovered, and whether the strip is following music, breathing
|
|
61
|
+
amber, or dark because the kiosk panel blanked. It also has a button to cycle
|
|
62
|
+
red/green/blue/amber for checking wiring without needing to play anything.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
python3 -m pip install Mopidy-JukeboxLights
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
```ini
|
|
73
|
+
[jukeboxlights]
|
|
74
|
+
enabled = true
|
|
75
|
+
wled_host = 172.20.25.44 # IP or host:port of your WLED device
|
|
76
|
+
brightness = 160 # 1-255
|
|
77
|
+
idle_after = 45 # seconds of silence before the idle effect
|
|
78
|
+
idle_color = 240,168,48 # amber
|
|
79
|
+
accent_segments = 1,2,3 # segment ids that get the accent color
|
|
80
|
+
follow_display = true
|
|
81
|
+
display_flag = /run/jukebox/display-off
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Segments are read from WLED at startup, so a strip run in one uncut piece with
|
|
85
|
+
hidden stretches behind a door frame works without any config here — define
|
|
86
|
+
the visible runs as WLED segments and this follows them.
|
|
87
|
+
|
|
88
|
+
### Turning the lights off with the screen
|
|
89
|
+
|
|
90
|
+
If something else on the machine creates the file named by `display_flag` when
|
|
91
|
+
a kiosk display blanks, the strip goes fully dark rather than breathing — but
|
|
92
|
+
only while nothing is playing. Remove the file and it comes back. Set
|
|
93
|
+
`follow_display = false` to ignore this entirely.
|
|
94
|
+
|
|
95
|
+
## Project resources
|
|
96
|
+
|
|
97
|
+
- [Source code](https://github.com/kingbutter/mopidy-jukebox-lights)
|
|
98
|
+
- [Issue tracker](https://github.com/kingbutter/mopidy-jukebox-lights/issues)
|
|
99
|
+
|
|
100
|
+
## Credits
|
|
101
|
+
|
|
102
|
+
- Original author: [King Butter](https://github.com/kingbutter)
|
|
103
|
+
- Current maintainer: [King Butter](https://github.com/kingbutter)
|
|
104
|
+
x
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
LICENSE
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
.github/workflows/ci.yml
|
|
6
|
+
src/Mopidy_JukeboxLights.egg-info/PKG-INFO
|
|
7
|
+
src/Mopidy_JukeboxLights.egg-info/SOURCES.txt
|
|
8
|
+
src/Mopidy_JukeboxLights.egg-info/dependency_links.txt
|
|
9
|
+
src/Mopidy_JukeboxLights.egg-info/entry_points.txt
|
|
10
|
+
src/Mopidy_JukeboxLights.egg-info/requires.txt
|
|
11
|
+
src/Mopidy_JukeboxLights.egg-info/scm_file_list.json
|
|
12
|
+
src/Mopidy_JukeboxLights.egg-info/scm_version.json
|
|
13
|
+
src/Mopidy_JukeboxLights.egg-info/top_level.txt
|
|
14
|
+
src/mopidy_jukebox_lights/__init__.py
|
|
15
|
+
src/mopidy_jukebox_lights/color.py
|
|
16
|
+
src/mopidy_jukebox_lights/ext.conf
|
|
17
|
+
src/mopidy_jukebox_lights/frontend.py
|
|
18
|
+
src/mopidy_jukebox_lights/web.py
|
|
19
|
+
tests/test_color.py
|
|
20
|
+
tests/test_extension.py
|
|
21
|
+
tests/test_frontend.py
|
|
22
|
+
tests/test_web.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
"pyproject.toml",
|
|
4
|
+
"LICENSE",
|
|
5
|
+
"README.md",
|
|
6
|
+
".gitignore",
|
|
7
|
+
".github/workflows/ci.yml",
|
|
8
|
+
"tests/test_frontend.py",
|
|
9
|
+
"tests/test_web.py",
|
|
10
|
+
"tests/test_color.py",
|
|
11
|
+
"tests/test_extension.py",
|
|
12
|
+
"src/mopidy_jukebox_lights/ext.conf",
|
|
13
|
+
"src/mopidy_jukebox_lights/__init__.py",
|
|
14
|
+
"src/mopidy_jukebox_lights/frontend.py",
|
|
15
|
+
"src/mopidy_jukebox_lights/color.py",
|
|
16
|
+
"src/mopidy_jukebox_lights/web.py"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mopidy_jukebox_lights
|