mirabox-stream-dock-sdk 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.
- mirabox_stream_dock_sdk-0.1.0/CHANGELOG.md +19 -0
- mirabox_stream_dock_sdk-0.1.0/LICENSE +21 -0
- mirabox_stream_dock_sdk-0.1.0/MANIFEST.in +4 -0
- mirabox_stream_dock_sdk-0.1.0/PKG-INFO +186 -0
- mirabox_stream_dock_sdk-0.1.0/README.md +157 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/README.md +29 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/build.spec +35 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/assets/icon.svg +4 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/manifest.json +42 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/property-inspector/counter.html +35 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/property-inspector/counter.js +14 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/property-inspector/mirabox-sdk.js +219 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/__init__.py +3 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/__main__.py +18 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/action_registry.py +10 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/actions/__init__.py +5 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/actions/counter.py +37 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/bootstrap.py +12 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/contracts.py +12 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/src/counter_plugin/plugin.py +24 -0
- mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/tests/test_counter_plugin.py +71 -0
- mirabox_stream_dock_sdk-0.1.0/pyproject.toml +61 -0
- mirabox_stream_dock_sdk-0.1.0/scripts/__init__.py +1 -0
- mirabox_stream_dock_sdk-0.1.0/scripts/verify_distribution.py +82 -0
- mirabox_stream_dock_sdk-0.1.0/scripts/verify_version.py +66 -0
- mirabox_stream_dock_sdk-0.1.0/setup.cfg +4 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/__init__.py +199 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/action.py +214 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/action_registry.py +58 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/cli.py +90 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/codecs.py +90 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/commands.py +184 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/connection.py +76 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/errors.py +73 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/events.py +296 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/json_types.py +23 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/parser.py +475 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/plugin.py +279 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/property_inspector/mirabox-sdk.js +219 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/protocols.py +67 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/py.typed +0 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/registration.py +260 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/resource_cli.py +40 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_sdk/resources.py +44 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/PKG-INFO +186 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/SOURCES.txt +52 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/dependency_links.txt +1 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/entry_points.txt +2 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/requires.txt +5 -0
- mirabox_stream_dock_sdk-0.1.0/src/mirabox_stream_dock_sdk.egg-info/top_level.txt +1 -0
- mirabox_stream_dock_sdk-0.1.0/tests/test_release_tools.py +41 -0
- mirabox_stream_dock_sdk-0.1.0/tests/test_resources.py +80 -0
- mirabox_stream_dock_sdk-0.1.0/tests/test_runtime.py +386 -0
- mirabox_stream_dock_sdk-0.1.0/tests/test_sdk.py +703 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file. The project
|
|
4
|
+
uses [Semantic Versioning](https://semver.org/); releases before `1.0.0` may
|
|
5
|
+
change public APIs between minor versions.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-07-19
|
|
10
|
+
|
|
11
|
+
- Added typed models for Stream Dock registration, events, and commands.
|
|
12
|
+
- Added strict JSON parsing with diagnostic field paths.
|
|
13
|
+
- Added typed codecs for settings and Property Inspector messages.
|
|
14
|
+
- Added the reusable action registry and plugin runtime.
|
|
15
|
+
- Added the WebSocket transport and common CLI lifecycle runner.
|
|
16
|
+
- Added the shared Property Inspector JavaScript client.
|
|
17
|
+
|
|
18
|
+
[Unreleased]: https://github.com/Nekit678/MiraboxStreamDockSDK/compare/v0.1.0...HEAD
|
|
19
|
+
[0.1.0]: https://github.com/Nekit678/MiraboxStreamDockSDK/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nekit678
|
|
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,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirabox-stream-dock-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed Python SDK for building MiraBox Stream Dock plugins
|
|
5
|
+
Author: Nekit678
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Nekit678/MiraboxStreamDockSDK
|
|
8
|
+
Project-URL: Documentation, https://github.com/Nekit678/MiraboxStreamDockSDK#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/Nekit678/MiraboxStreamDockSDK.git
|
|
10
|
+
Project-URL: Issues, https://github.com/Nekit678/MiraboxStreamDockSDK/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/Nekit678/MiraboxStreamDockSDK/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: mirabox,stream-dock,plugin,sdk,websocket
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: websocket-client<2,>=1.8
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build<2,>=1.2; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff==0.15.21; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# MiraBox Stream Dock SDK for Python
|
|
31
|
+
|
|
32
|
+
Typed, unofficial Python SDK for building plugins for MiraBox Stream Dock. It
|
|
33
|
+
implements the WebSocket protocol, registration, typed event parsing, outbound
|
|
34
|
+
commands, per-plugin action registration, action lifecycle, plugin services,
|
|
35
|
+
and a shared Property Inspector client.
|
|
36
|
+
|
|
37
|
+
This project is not affiliated with or endorsed by MiraBox, HotSpot, or Elgato.
|
|
38
|
+
The `connectElgatoStreamDeckSocket` callback name is kept because Stream Dock
|
|
39
|
+
uses it for Property Inspector compatibility.
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
- Python 3.11 or newer;
|
|
44
|
+
- MiraBox Stream Dock 2.10.179.426 or newer;
|
|
45
|
+
- Windows for packaging a Python plugin with PyInstaller.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m pip install mirabox-stream-dock-sdk
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For SDK development:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python -m venv .venv
|
|
57
|
+
.venv/bin/python -m pip install -e ".[dev]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
On Windows, use `.venv\Scripts\python.exe` instead.
|
|
61
|
+
|
|
62
|
+
## Minimal plugin
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from __future__ import annotations
|
|
66
|
+
|
|
67
|
+
from dataclasses import dataclass
|
|
68
|
+
|
|
69
|
+
from mirabox_sdk import (
|
|
70
|
+
Action,
|
|
71
|
+
ActionRegistry,
|
|
72
|
+
JsonObject,
|
|
73
|
+
KeyDownEvent,
|
|
74
|
+
PluginLaunchArguments,
|
|
75
|
+
StreamDockPlugin,
|
|
76
|
+
StreamDockSender,
|
|
77
|
+
WebSocketStreamDockConnection,
|
|
78
|
+
WillAppearEvent,
|
|
79
|
+
run_plugin_cli,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
ACTION_UUID = "com.example.counter.increment"
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass(frozen=True, slots=True)
|
|
86
|
+
class Dependencies:
|
|
87
|
+
stream_dock: StreamDockSender
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
registry: ActionRegistry[Dependencies] = ActionRegistry()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@registry.register(ACTION_UUID)
|
|
94
|
+
class CounterAction(Action[JsonObject, Dependencies]):
|
|
95
|
+
def _render(self) -> None:
|
|
96
|
+
count = self.settings.get("count", 0)
|
|
97
|
+
self.set_title(str(count if type(count) is int else 0))
|
|
98
|
+
|
|
99
|
+
def on_will_appear(self, _event: WillAppearEvent) -> None:
|
|
100
|
+
self._render()
|
|
101
|
+
|
|
102
|
+
def on_key_down(self, _event: KeyDownEvent) -> None:
|
|
103
|
+
count = self.settings.get("count", 0)
|
|
104
|
+
self.set_settings({"count": (count if type(count) is int else 0) + 1})
|
|
105
|
+
self._render()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def build_application(arguments: PluginLaunchArguments) -> StreamDockPlugin[Dependencies]:
|
|
109
|
+
connection = WebSocketStreamDockConnection(arguments.port)
|
|
110
|
+
return StreamDockPlugin(
|
|
111
|
+
arguments,
|
|
112
|
+
stream_dock=connection,
|
|
113
|
+
action_registry=registry,
|
|
114
|
+
action_dependencies=Dependencies(connection),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
if __name__ == "__main__":
|
|
119
|
+
raise SystemExit(run_plugin_cli(build_application))
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The action UUID must also be declared in the plugin's `manifest.json`.
|
|
123
|
+
|
|
124
|
+
## Property Inspector client
|
|
125
|
+
|
|
126
|
+
Copy the versioned JavaScript client into the plugin bundle:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
mirabox-sdk copy-property-inspector \
|
|
130
|
+
com.example.counter.sdPlugin/property-inspector
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Use `--force` to replace a different existing copy. Include the client before
|
|
134
|
+
the action-specific script:
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<script src="mirabox-sdk.js"></script>
|
|
138
|
+
<script src="counter.js"></script>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The action script can use `window.MiraBoxPropertyInspector`:
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
const client = window.MiraBoxPropertyInspector;
|
|
145
|
+
client.on("connected", ({ settings }) => console.log(settings));
|
|
146
|
+
client.sendToPlugin({ event: "refresh" });
|
|
147
|
+
client.updateSettings({ mode: "toggle" });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Public API
|
|
151
|
+
|
|
152
|
+
- `events.py` contains typed inbound event models.
|
|
153
|
+
- `commands.py` contains outbound command models.
|
|
154
|
+
- `parser.py` validates wire JSON and reports exact invalid field paths.
|
|
155
|
+
- `codecs.py` converts plugin-owned settings and messages to typed objects.
|
|
156
|
+
- `Action` and `ActionRegistry` model action instances and registrations.
|
|
157
|
+
- `StreamDockPlugin` dispatches events and manages service lifecycle.
|
|
158
|
+
- `WebSocketStreamDockConnection` implements the Stream Dock transport.
|
|
159
|
+
- `run_plugin_cli` handles the standard executable arguments and shutdown.
|
|
160
|
+
|
|
161
|
+
The supported public surface is exported from `mirabox_sdk`. Other module-level
|
|
162
|
+
objects are implementation details unless documented otherwise.
|
|
163
|
+
|
|
164
|
+
## Checks
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
python -m unittest discover -s tests -v
|
|
168
|
+
python -m compileall -q src tests scripts examples
|
|
169
|
+
ruff check src tests scripts examples
|
|
170
|
+
ruff format --check src tests scripts examples
|
|
171
|
+
python -m build
|
|
172
|
+
python scripts/verify_distribution.py dist
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Releasing
|
|
176
|
+
|
|
177
|
+
1. Update the version in `pyproject.toml`, `src/mirabox_sdk/__init__.py`, and
|
|
178
|
+
`CHANGELOG.md`.
|
|
179
|
+
2. Run all checks and build the distributions.
|
|
180
|
+
3. Create and push the matching tag, for example `v0.1.0`.
|
|
181
|
+
4. The release workflow publishes the wheel and source archive to PyPI through
|
|
182
|
+
Trusted Publishing and attaches them to a GitHub Release.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
[MIT](https://github.com/Nekit678/MiraboxStreamDockSDK/blob/main/LICENSE)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# MiraBox Stream Dock SDK for Python
|
|
2
|
+
|
|
3
|
+
Typed, unofficial Python SDK for building plugins for MiraBox Stream Dock. It
|
|
4
|
+
implements the WebSocket protocol, registration, typed event parsing, outbound
|
|
5
|
+
commands, per-plugin action registration, action lifecycle, plugin services,
|
|
6
|
+
and a shared Property Inspector client.
|
|
7
|
+
|
|
8
|
+
This project is not affiliated with or endorsed by MiraBox, HotSpot, or Elgato.
|
|
9
|
+
The `connectElgatoStreamDeckSocket` callback name is kept because Stream Dock
|
|
10
|
+
uses it for Property Inspector compatibility.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Python 3.11 or newer;
|
|
15
|
+
- MiraBox Stream Dock 2.10.179.426 or newer;
|
|
16
|
+
- Windows for packaging a Python plugin with PyInstaller.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python -m pip install mirabox-stream-dock-sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For SDK development:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m venv .venv
|
|
28
|
+
.venv/bin/python -m pip install -e ".[dev]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
On Windows, use `.venv\Scripts\python.exe` instead.
|
|
32
|
+
|
|
33
|
+
## Minimal plugin
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from __future__ import annotations
|
|
37
|
+
|
|
38
|
+
from dataclasses import dataclass
|
|
39
|
+
|
|
40
|
+
from mirabox_sdk import (
|
|
41
|
+
Action,
|
|
42
|
+
ActionRegistry,
|
|
43
|
+
JsonObject,
|
|
44
|
+
KeyDownEvent,
|
|
45
|
+
PluginLaunchArguments,
|
|
46
|
+
StreamDockPlugin,
|
|
47
|
+
StreamDockSender,
|
|
48
|
+
WebSocketStreamDockConnection,
|
|
49
|
+
WillAppearEvent,
|
|
50
|
+
run_plugin_cli,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
ACTION_UUID = "com.example.counter.increment"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass(frozen=True, slots=True)
|
|
57
|
+
class Dependencies:
|
|
58
|
+
stream_dock: StreamDockSender
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
registry: ActionRegistry[Dependencies] = ActionRegistry()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@registry.register(ACTION_UUID)
|
|
65
|
+
class CounterAction(Action[JsonObject, Dependencies]):
|
|
66
|
+
def _render(self) -> None:
|
|
67
|
+
count = self.settings.get("count", 0)
|
|
68
|
+
self.set_title(str(count if type(count) is int else 0))
|
|
69
|
+
|
|
70
|
+
def on_will_appear(self, _event: WillAppearEvent) -> None:
|
|
71
|
+
self._render()
|
|
72
|
+
|
|
73
|
+
def on_key_down(self, _event: KeyDownEvent) -> None:
|
|
74
|
+
count = self.settings.get("count", 0)
|
|
75
|
+
self.set_settings({"count": (count if type(count) is int else 0) + 1})
|
|
76
|
+
self._render()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def build_application(arguments: PluginLaunchArguments) -> StreamDockPlugin[Dependencies]:
|
|
80
|
+
connection = WebSocketStreamDockConnection(arguments.port)
|
|
81
|
+
return StreamDockPlugin(
|
|
82
|
+
arguments,
|
|
83
|
+
stream_dock=connection,
|
|
84
|
+
action_registry=registry,
|
|
85
|
+
action_dependencies=Dependencies(connection),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
raise SystemExit(run_plugin_cli(build_application))
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The action UUID must also be declared in the plugin's `manifest.json`.
|
|
94
|
+
|
|
95
|
+
## Property Inspector client
|
|
96
|
+
|
|
97
|
+
Copy the versioned JavaScript client into the plugin bundle:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
mirabox-sdk copy-property-inspector \
|
|
101
|
+
com.example.counter.sdPlugin/property-inspector
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use `--force` to replace a different existing copy. Include the client before
|
|
105
|
+
the action-specific script:
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<script src="mirabox-sdk.js"></script>
|
|
109
|
+
<script src="counter.js"></script>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The action script can use `window.MiraBoxPropertyInspector`:
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
const client = window.MiraBoxPropertyInspector;
|
|
116
|
+
client.on("connected", ({ settings }) => console.log(settings));
|
|
117
|
+
client.sendToPlugin({ event: "refresh" });
|
|
118
|
+
client.updateSettings({ mode: "toggle" });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Public API
|
|
122
|
+
|
|
123
|
+
- `events.py` contains typed inbound event models.
|
|
124
|
+
- `commands.py` contains outbound command models.
|
|
125
|
+
- `parser.py` validates wire JSON and reports exact invalid field paths.
|
|
126
|
+
- `codecs.py` converts plugin-owned settings and messages to typed objects.
|
|
127
|
+
- `Action` and `ActionRegistry` model action instances and registrations.
|
|
128
|
+
- `StreamDockPlugin` dispatches events and manages service lifecycle.
|
|
129
|
+
- `WebSocketStreamDockConnection` implements the Stream Dock transport.
|
|
130
|
+
- `run_plugin_cli` handles the standard executable arguments and shutdown.
|
|
131
|
+
|
|
132
|
+
The supported public surface is exported from `mirabox_sdk`. Other module-level
|
|
133
|
+
objects are implementation details unless documented otherwise.
|
|
134
|
+
|
|
135
|
+
## Checks
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python -m unittest discover -s tests -v
|
|
139
|
+
python -m compileall -q src tests scripts examples
|
|
140
|
+
ruff check src tests scripts examples
|
|
141
|
+
ruff format --check src tests scripts examples
|
|
142
|
+
python -m build
|
|
143
|
+
python scripts/verify_distribution.py dist
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Releasing
|
|
147
|
+
|
|
148
|
+
1. Update the version in `pyproject.toml`, `src/mirabox_sdk/__init__.py`, and
|
|
149
|
+
`CHANGELOG.md`.
|
|
150
|
+
2. Run all checks and build the distributions.
|
|
151
|
+
3. Create and push the matching tag, for example `v0.1.0`.
|
|
152
|
+
4. The release workflow publishes the wheel and source archive to PyPI through
|
|
153
|
+
Trusted Publishing and attaches them to a GitHub Release.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
[MIT](https://github.com/Nekit678/MiraboxStreamDockSDK/blob/main/LICENSE)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Counter example plugin
|
|
2
|
+
|
|
3
|
+
This is a minimal binary Stream Dock plugin built with `mirabox-stream-dock-sdk`.
|
|
4
|
+
Each press increments a persisted counter; the Property Inspector can reset it.
|
|
5
|
+
|
|
6
|
+
From the SDK repository:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
python -m pip install -e ".[dev]"
|
|
10
|
+
mirabox-sdk copy-property-inspector \
|
|
11
|
+
examples/counter_plugin/com.example.counter.sdPlugin/property-inspector
|
|
12
|
+
PYTHONPATH=examples/counter_plugin/src python -m counter_plugin \
|
|
13
|
+
-port 12345 \
|
|
14
|
+
-pluginUUID com.example.counter \
|
|
15
|
+
-registerEvent registerPlugin \
|
|
16
|
+
-info '{"application":{"language":"en","platform":"windows","platformVersion":"11","version":"2.10"},"colors":{},"devicePixelRatio":1,"devices":[],"plugin":{"uuid":"com.example.counter","version":"0.1.0"}}'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build the Windows executable from the SDK virtual environment:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
python -m pip install pyinstaller
|
|
23
|
+
python -m PyInstaller --clean --noconfirm examples/counter_plugin/build.spec
|
|
24
|
+
Copy-Item dist\CounterPlugin.exe `
|
|
25
|
+
examples\counter_plugin\com.example.counter.sdPlugin\
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Copy the `.sdPlugin` directory to
|
|
29
|
+
`%APPDATA%\HotSpot\StreamDock\plugins\` and restart Stream Dock.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- mode: python ; coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
a = Analysis(
|
|
4
|
+
["src/counter_plugin/__main__.py"],
|
|
5
|
+
pathex=["src"],
|
|
6
|
+
binaries=[],
|
|
7
|
+
datas=[],
|
|
8
|
+
hiddenimports=[],
|
|
9
|
+
hookspath=[],
|
|
10
|
+
hooksconfig={},
|
|
11
|
+
runtime_hooks=[],
|
|
12
|
+
excludes=[],
|
|
13
|
+
noarchive=False,
|
|
14
|
+
optimize=0,
|
|
15
|
+
)
|
|
16
|
+
pyz = PYZ(a.pure)
|
|
17
|
+
|
|
18
|
+
exe = EXE(
|
|
19
|
+
pyz,
|
|
20
|
+
a.scripts,
|
|
21
|
+
a.binaries,
|
|
22
|
+
a.datas,
|
|
23
|
+
[],
|
|
24
|
+
name="CounterPlugin",
|
|
25
|
+
debug=False,
|
|
26
|
+
bootloader_ignore_signals=False,
|
|
27
|
+
strip=False,
|
|
28
|
+
upx=False,
|
|
29
|
+
console=False,
|
|
30
|
+
disable_windowed_traceback=False,
|
|
31
|
+
argv_emulation=False,
|
|
32
|
+
target_arch=None,
|
|
33
|
+
codesign_identity=None,
|
|
34
|
+
entitlements_file=None,
|
|
35
|
+
)
|
mirabox_stream_dock_sdk-0.1.0/examples/counter_plugin/com.example.counter.sdPlugin/manifest.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Actions": [
|
|
3
|
+
{
|
|
4
|
+
"UUID": "com.example.counter.increment",
|
|
5
|
+
"Name": "Counter",
|
|
6
|
+
"Tooltip": "Increment a persisted counter",
|
|
7
|
+
"Icon": "assets/icon.svg",
|
|
8
|
+
"PropertyInspectorPath": "property-inspector/counter.html",
|
|
9
|
+
"SupportedInMultiActions": true,
|
|
10
|
+
"UserTitleEnabled": false,
|
|
11
|
+
"Controllers": [
|
|
12
|
+
"Keypad"
|
|
13
|
+
],
|
|
14
|
+
"States": [
|
|
15
|
+
{
|
|
16
|
+
"Image": "assets/icon.svg",
|
|
17
|
+
"ShowTitle": true,
|
|
18
|
+
"TitleAlignment": "bottom",
|
|
19
|
+
"FontSize": "18"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"Version": "0.1.0",
|
|
25
|
+
"Name": "Counter",
|
|
26
|
+
"Icon": "assets/icon.svg",
|
|
27
|
+
"CategoryIcon": "assets/icon.svg",
|
|
28
|
+
"Category": "Examples",
|
|
29
|
+
"Description": "Minimal counter plugin built with mirabox-stream-dock-sdk",
|
|
30
|
+
"CodePath": "CounterPlugin.exe",
|
|
31
|
+
"SDKVersion": 1,
|
|
32
|
+
"Author": "Example Author",
|
|
33
|
+
"OS": [
|
|
34
|
+
{
|
|
35
|
+
"Platform": "windows",
|
|
36
|
+
"MinimumVersion": "11"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"Software": {
|
|
40
|
+
"MinimumVersion": "2.10.179.426"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Counter</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
color-scheme: dark;
|
|
10
|
+
font-family: system-ui, sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
margin: 16px;
|
|
15
|
+
color: #e8e8e8;
|
|
16
|
+
background: #2d2d2d;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
button {
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: 8px;
|
|
22
|
+
color: inherit;
|
|
23
|
+
border: 1px solid #555;
|
|
24
|
+
border-radius: 4px;
|
|
25
|
+
background: #3a3a3a;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<button id="reset" type="button" disabled>Reset counter</button>
|
|
32
|
+
<script src="mirabox-sdk.js"></script>
|
|
33
|
+
<script src="counter.js"></script>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const client = window.MiraBoxPropertyInspector;
|
|
5
|
+
const reset = document.getElementById("reset");
|
|
6
|
+
|
|
7
|
+
client.on("connected", () => {
|
|
8
|
+
reset.disabled = false;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
reset.addEventListener("click", () => {
|
|
12
|
+
client.sendToPlugin({ event: "reset" });
|
|
13
|
+
});
|
|
14
|
+
})();
|