19
19
</a>
20
20
</p >
21
21
22
+ <p align =" center " >
23
+ <a href="https://github.com/gri-gus/streamdeck-python-sdk/blob/main/README.md" target="_blank">
24
+ <img src="https://img.shields.io/badge/lang-en-yellow.svg" alt="lang-ru">
25
+ </a>
26
+ <a href="https://github.com/gri-gus/streamdeck-python-sdk/blob/main/README.ru.md" target="_blank">
27
+ <img src="https://img.shields.io/badge/lang-ru-yellow.svg" alt="lang-ru">
28
+ </a>
29
+ </p >
30
+
22
31
# streamdeck-python-sdk
23
32
24
33
Library for creating Stream Deck plugins in Python.
@@ -30,9 +39,9 @@ Library for creating Stream Deck plugins in Python.
30
39
* MacOS: 10.14 or later
31
40
* Windows: 10 or later
32
41
33
- ** Supported Stream Deck application :** 6.0, 6.1, 6.2
42
+ ** Supported Stream Deck versions :** 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6
34
43
35
- ** Supported Python:** 3.7 or later
44
+ ** Supported Python versions :** 3.8 or later
36
45
37
46
## Installation
38
47
@@ -48,18 +57,94 @@ pip install streamdeck_sdk
48
57
49
58
## Features
50
59
51
- * Easy use. You can quickly create your own plugin without having to understand how websockets and other complicated
52
- things work.
60
+ * Ease of use. You can quickly create your own plugin without having to understand how websockets and
61
+ other technologies work.
53
62
* Fully typed, using [ pydantic] ( https://github.com/pydantic/pydantic ) .
54
63
* Includes image to base64 converters for easy installation of icons on keys.
55
64
* Includes a decorator for functions and methods to run on a separate thread.
56
65
* Exception logging and easy logging configuration.
66
+ * Debug mode via ` PyCharm ` or other debugging tools.
67
+ * A complete protocol for interaction with the Stream Deck application has been implemented.
68
+ * Quick start of a project via the console command ` streamdeck_sdk startproject ` .
69
+ * Build the project using the ` streamdeck_sdk build ` console command.
57
70
58
- ## How to use Documentation if it is not written?
71
+ ## Quick Start
72
+
73
+ 1 . Install Python.
74
+ 2 . Create a project folder and ` venv ` .
75
+ 3 . Go to the project folder, activate ` venv ` and install the ` streamdeck-sdk ` library:
76
+
77
+ ``` shell
78
+ pip install streamdeck-sdk
79
+ ```
80
+
81
+ 4 . Run the command to start the project:
82
+
83
+ ``` shell
84
+ streamdeck_sdk startproject
85
+ ```
86
+
87
+ After completing this step, the folder ` com.bestdeveloper.mytestplugin.sdPlugin ` will appear with a test project and
88
+ files for build.
89
+
90
+ 5 . Build the plugin using the command:
91
+
92
+ ``` shell
93
+ streamdeck_sdk build -i com.bestdeveloper.mytestplugin.sdPlugin
94
+ ```
59
95
60
- > 🧑💻 Documentation under development
96
+ 6 . Install the ` releases/{date}/com.bestdeveloper.mytestplugin.streamDeckPlugin ` plugin into the Stream Deck
97
+ application. Usually installed via double click.
61
98
62
- > To get started, take a look at the Examples of plugins below, then move on to this section.
99
+ > ⚠️ After installation, you need to wait about 40 seconds. At this time, requirements are installed.
100
+
101
+ 7 . Go to the Stream Deck application in the ` MyTestCategory ` category and set the ` My action ` action to any button.
102
+ 8 . Check the operation of the ` My action ` action.
103
+ When clicked, the following happens:
104
+ 1 . The github page opens.
105
+ 2 . ✅ appears on the button.
106
+
107
+ Next, edit the project in accordance with the official documentation [ Stream Deck SDK] ( https://docs.elgato.com/sdk ) .
108
+ > ⚠️ Don't forget to edit the ` manifest.json ` file and the plugin name.
109
+
110
+ ## Debug mode
111
+
112
+ 1 . Follow steps 1-4 from the "Quick Start" section.
113
+ 2 . In the file ` com.bestdeveloper.mytestplugin.sdPlugin/code/main.py `
114
+ in the StreamDeck parameters, specify ` debug=True ` , as in the example:
115
+
116
+ ``` python
117
+ if __name__ == ' __main__' :
118
+ StreamDeck(
119
+ actions = [
120
+ MyAction(),
121
+ ],
122
+ debug = True ,
123
+ log_file = settings.LOG_FILE_PATH ,
124
+ log_level = settings.LOG_LEVEL ,
125
+ log_backup_count = 1 ,
126
+ ).run()
127
+ ```
128
+
129
+ 3 . Follow steps 5-7 from the "Quick Start" section.
130
+ 4 . Place a breakpoint where you are interested in ` PyCharm ` .
131
+ For example, on the line:
132
+
133
+ ``` python
134
+ self .open_url(" https://github.com/gri-gus/streamdeck-python-sdk" )
135
+ ```
136
+
137
+ 5 . Run the file ` com.bestdeveloper.mytestplugin.sdPlugin/code/main.py ` in Debug mode in ` PyCharm ` .
138
+
139
+ > ⚠️ If you run only the plugin in the Stream Deck application, there will be no reaction to pressing the button.
140
+
141
+ 6 . Click the button on Stream Deck. The code execution will stop at the line from point 4.
142
+
143
+ > ⚠️ Don't forget to set ` debug=False ` when building the finished plugin.
144
+
145
+ ## Understanding usage
146
+
147
+ > To get started, check out the sample plugins below, then continue on to this section.
63
148
64
149
Let's look at an example of how the ` self.send_to_property_inspector ` method works.
65
150
@@ -71,9 +156,7 @@ calling `self.send_to_property_inspector`: [click](https://docs.elgato.com/sdk/p
71
156
Here is the resulting object in the Property inspector when
72
157
calling ` self.send_to_property_inspector ` : [ click] ( https://docs.elgato.com/sdk/plugins/events-received#sendtopropertyinspector )
73
158
74
- Here is the method source code for
75
- the [ self.send_to_property_inspector] ( https://github.com/gri-gus/streamdeck-python-sdk/blob/27652ed919cb85b94e91258487a2d2aba6087466/src/streamdeck_sdk/mixins.py#L177 )
76
- method:
159
+ Here is the source code for the method ` self.send_to_property_inspector ` method:
77
160
78
161
``` python
79
162
def send_to_property_inspector (
@@ -90,8 +173,7 @@ def send_to_property_inspector(
90
173
self .send(message)
91
174
```
92
175
93
- As we can see, it accepts function parameters and transfers them to the
94
- object [ events_sent_objs.SendToPropertyInspector] ( https://github.com/gri-gus/streamdeck-python-sdk/blob/27652ed919cb85b94e91258487a2d2aba6087466/src/streamdeck_sdk/sd_objs/events_sent_objs.py#L121 ) :
176
+ As we can see, it takes function parameters and passes them to the object ` events_sent_objs.SendToPropertyInspector ` :
95
177
96
178
``` python
97
179
class SendToPropertyInspector (BaseModel ):
@@ -101,20 +183,18 @@ class SendToPropertyInspector(BaseModel):
101
183
event: str = " sendToPropertyInspector"
102
184
```
103
185
104
- Next in the
105
- method [ self.send] ( https://github.com/gri-gus/streamdeck-python-sdk/blob/27652ed919cb85b94e91258487a2d2aba6087466/src/streamdeck_sdk/mixins.py#L16 )
106
- the pydantic object is converted to json and sent to Property Inspector.
186
+ Next, in the ` self.send ` method, the pydantic object is converted to json and sent to the plugin’s Property Inspector.
107
187
108
188
** What is ` payload ` ?**
109
189
110
- It's any ` dict ` you want. But there is a condition, it must be convertible to json.
190
+ This is any ` dict ` that can be converted to json.
111
191
112
- ** How Property inspector does receive payload data ?**
192
+ ** How does Property Inspector get data from ` payload ` ?**
113
193
114
194
To answer this question, you need to look at the source
115
- code [ streamdeck-javascript-sdk] ( https://github.com/elgatosf/streamdeck-javascript-sdk ) . As I understand, in their sdk
116
- there is a
117
- method [ onSendToPropertyInspector] ( https://github.com/elgatosf/streamdeck-javascript-sdk/blob/7d2ba3ce41620dbb6c2f2a69a158224f6d95ef22/js/property-inspector.js#L20 )
195
+ code [ streamdeck-javascript-sdk] ( https://github.com/elgatosf/streamdeck-javascript-sdk ) .
196
+ There is a method in the sdk
197
+ [ onSendToPropertyInspector] ( https://github.com/elgatosf/streamdeck-javascript-sdk/blob/7d2ba3ce41620dbb6c2f2a69a158224f6d95ef22/js/property-inspector.js#L20 )
118
198
and most likely it should be used like this:
119
199
120
200
``` js
@@ -124,11 +204,9 @@ $PI.onSendToPropertyInspector("com.ggusev.keyboard.write", jsn => {
124
204
});
125
205
```
126
206
127
- Instead of ` "com.ggusev.keyboard.write" ` you need to substitute the name of your action.
207
+ Instead of ` "com.ggusev.keyboard.write" ` you need to substitute the name of your ` action ` .
128
208
129
209
## Examples
130
210
131
- [ LoremFlickr] ( https://github.com/gri-gus/loremflickr-streamdeck-plugin ) - Plugin for installing images from LoremFlickr
132
- to button. Supports MacOS and Windows.
133
-
134
- ---
211
+ [ LoremFlickr] ( https://github.com/gri-gus/loremflickr-streamdeck-plugin ) - Plugin for installing images on a button from
212
+ the LoremFlickr site. Supports MacOS and Windows.
0 commit comments