kryten-cli 2.1.1__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.
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ All notable changes to kryten-cli will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.1.1] - 2025-12-09
9
+
10
+ ### Changed
11
+
12
+ - Version bump to trigger PyPI release after project name reservation
13
+ - All changes from v2.1.0 included
14
+
15
+ ## [2.1.0] - 2025-12-09
16
+
17
+ ### Changed
18
+
19
+ - **Compatibility**: Lowered minimum Python version requirement from 3.11 to 3.10
20
+ - Updated dependency to kryten-py>=0.5.7 which supports Python 3.10
21
+ - Added Python 3.10 classifier
22
+ - Enhanced PyPI packaging with proper metadata and README
23
+
24
+ ### Added
25
+
26
+ - **PyPI Publishing**: Added GitHub Actions workflow for automated PyPI releases
27
+ - Enhanced setup.py with comprehensive metadata for PyPI
28
+ - MANIFEST.in for proper file inclusion in distribution
29
+ - MIT License file
30
+
31
+ ## [2.0.0] - 2025-12-08
32
+
33
+ ### Changed
34
+ - **BREAKING**: Complete rewrite to use `kryten-py` library instead of direct NATS calls
35
+ - Replaced all direct NATS publish operations with high-level KrytenClient methods
36
+ - Updated configuration format to support `channels` array (maintains backward compatibility with legacy `cytube.channel` format)
37
+ - Improved error handling and user feedback messages
38
+ - Added URL parsing for media commands (YouTube, Vimeo, Dailymotion)
39
+ - Updated dependency from `nats-py` to `kryten-py>=1.0.0`
40
+
41
+ ### Added
42
+ - Media URL parsing for automatic type detection (YouTube, Vimeo, Dailymotion)
43
+ - Support for new kryten-py configuration format
44
+ - Better success messages showing channel and action details
45
+ - `config.example.json` template file
46
+
47
+ ### Improved
48
+ - Code is now cleaner and more maintainable
49
+ - Type safety through kryten-py's typed API
50
+ - Better separation of concerns
51
+ - Consistent error handling
52
+
53
+ ### Removed
54
+ - Direct NATS client usage
55
+ - Manual subject construction
56
+ - Manual message encoding/decoding
57
+
58
+ ## [1.0.0] - 2024
59
+
60
+ ### Added
61
+ - Initial release with direct NATS implementation
62
+ - Chat commands (say, pm)
63
+ - Playlist commands (add, addnext, del, move, jump, clear, shuffle, settemp)
64
+ - Playback commands (pause, play, seek)
65
+ - Moderation commands (kick, ban, voteskip)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kryten Robot Team
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,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include requirements.txt
5
+ include config.example.json
6
+ include examples.sh
7
+ include examples.ps1
8
+ recursive-include docs *.md
@@ -0,0 +1,313 @@
1
+ Metadata-Version: 2.4
2
+ Name: kryten-cli
3
+ Version: 2.1.1
4
+ Summary: Command-line client for CyTube via kryten-py library
5
+ Home-page: https://github.com/grobertson/kryten-cli
6
+ Author: Kryten Robot Team
7
+ Author-email: Kryten Robot Team <kryten@example.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/grobertson/kryten-cli
10
+ Project-URL: Bug Tracker, https://github.com/grobertson/kryten-cli/issues
11
+ Project-URL: Source Code, https://github.com/grobertson/kryten-cli
12
+ Project-URL: Documentation, https://github.com/grobertson/kryten-cli/blob/main/README.md
13
+ Keywords: cytube,nats,cli,command-line,microservices,bot
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Communications :: Chat
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: kryten-py>=0.5.7
27
+ Dynamic: author
28
+ Dynamic: home-page
29
+ Dynamic: license-file
30
+ Dynamic: requires-python
31
+
32
+ # Kryten CLI
33
+
34
+ Command-line client for sending CyTube commands via the kryten-py library.
35
+
36
+ ## Overview
37
+
38
+ This CLI provides a simple command-line interface to control CyTube channels through the Kryten bridge. It uses the high-level `kryten-py` library for all communication, making it a clean and maintainable reference implementation.
39
+
40
+ ## Installation
41
+
42
+ Install the CLI tool:
43
+
44
+ ```bash
45
+ pip install -e .
46
+ ```
47
+
48
+ This will automatically install the `kryten-py` dependency.
49
+
50
+ Or run directly:
51
+
52
+ ```bash
53
+ python kryten_cli.py --help
54
+ ```
55
+
56
+ ## Configuration
57
+
58
+ The CLI reads connection settings from `config.json` in the current directory. Create one with your NATS server and CyTube channel:
59
+
60
+ ```json
61
+ {
62
+ "nats": {
63
+ "servers": ["nats://localhost:4222"]
64
+ },
65
+ "channels": [
66
+ {
67
+ "domain": "cytu.be",
68
+ "channel": "your-channel-name"
69
+ }
70
+ ]
71
+ }
72
+ ```
73
+
74
+ **Legacy Format Support:** The CLI also supports the older config format with `cytube.channel` for backward compatibility.
75
+
76
+ You can also specify a different config file:
77
+
78
+ ```bash
79
+ kryten --config /path/to/config.json say "Hello"
80
+ ```
81
+
82
+ ## Usage Examples
83
+
84
+ ### Chat Commands
85
+
86
+ Send a chat message:
87
+ ```bash
88
+ kryten say "Hello world"
89
+ ```
90
+
91
+ Send a private message:
92
+ ```bash
93
+ kryten pm UserName "Hi there!"
94
+ ```
95
+
96
+ ### Playlist Commands
97
+
98
+ Add video to end of playlist:
99
+ ```bash
100
+ kryten playlist add https://youtube.com/watch?v=xyz
101
+ kryten playlist add yt:abc123
102
+ ```
103
+
104
+ Add video to play next:
105
+ ```bash
106
+ kryten playlist addnext https://youtube.com/watch?v=abc
107
+ ```
108
+
109
+ Add as temporary (auto-deleted after playing):
110
+ ```bash
111
+ kryten playlist add --temp https://youtube.com/watch?v=xyz
112
+ ```
113
+
114
+ Delete video from playlist:
115
+ ```bash
116
+ kryten playlist del video-uid-123
117
+ ```
118
+
119
+ Move video in playlist:
120
+ ```bash
121
+ kryten playlist move video-uid-5 after video-uid-3
122
+ ```
123
+
124
+ Jump to specific video:
125
+ ```bash
126
+ kryten playlist jump video-uid-7
127
+ ```
128
+
129
+ Clear entire playlist:
130
+ ```bash
131
+ kryten playlist clear
132
+ ```
133
+
134
+ Shuffle playlist:
135
+ ```bash
136
+ kryten playlist shuffle
137
+ ```
138
+
139
+ Set video temporary status:
140
+ ```bash
141
+ kryten playlist settemp video-uid-5 true
142
+ kryten playlist settemp video-uid-5 false
143
+ ```
144
+
145
+ ### Playback Commands
146
+
147
+ Pause current video:
148
+ ```bash
149
+ kryten pause
150
+ ```
151
+
152
+ Resume playback:
153
+ ```bash
154
+ kryten play
155
+ ```
156
+
157
+ Seek to timestamp (in seconds):
158
+ ```bash
159
+ kryten seek 120.5
160
+ ```
161
+
162
+ ### Moderation Commands
163
+
164
+ Kick user:
165
+ ```bash
166
+ kryten kick UserName
167
+ kryten kick UserName "Stop spamming"
168
+ ```
169
+
170
+ Ban user:
171
+ ```bash
172
+ kryten ban UserName
173
+ kryten ban UserName "Banned for harassment"
174
+ ```
175
+
176
+ Vote to skip current video:
177
+ ```bash
178
+ kryten voteskip
179
+ ```
180
+
181
+ ## Command Reference
182
+
183
+ | Command | Description |
184
+ |---------|-------------|
185
+ | `say <message>` | Send a chat message |
186
+ | `pm <user> <message>` | Send a private message |
187
+ | `playlist add <url>` | Add video to end of playlist |
188
+ | `playlist addnext <url>` | Add video to play next |
189
+ | `playlist del <uid>` | Delete video from playlist |
190
+ | `playlist move <uid> after <uid>` | Move video in playlist |
191
+ | `playlist jump <uid>` | Jump to specific video |
192
+ | `playlist clear` | Clear entire playlist |
193
+ | `playlist shuffle` | Shuffle playlist |
194
+ | `playlist settemp <uid> <true\|false>` | Set temporary status |
195
+ | `pause` | Pause playback |
196
+ | `play` | Resume playback |
197
+ | `seek <seconds>` | Seek to timestamp |
198
+ | `kick <user> [reason]` | Kick user from channel |
199
+ | `ban <user> [reason]` | Ban user from channel |
200
+ | `voteskip` | Vote to skip current video |
201
+
202
+ ## Options
203
+
204
+ | Option | Description |
205
+ |--------|-------------|
206
+ | `--config <path>` | Path to config file (default: config.json) |
207
+ | `--channel <name>` | Override channel from config |
208
+ | `--help` | Show help message |
209
+
210
+ ## NATS Message Format
211
+
212
+ All commands are published to NATS subjects following this pattern:
213
+
214
+ ```
215
+ cytube.commands.{channel}.{action}
216
+ ```
217
+
218
+ Message payload:
219
+ ```json
220
+ {
221
+ "action": "chat",
222
+ "data": {
223
+ "message": "Hello world"
224
+ }
225
+ }
226
+ ```
227
+
228
+ This format is compatible with the Kryten bidirectional bridge's `CommandSubscriber`.
229
+
230
+ ## Requirements
231
+
232
+ - Python 3.11+
233
+ - nats-py >= 2.9.0
234
+ - Kryten bidirectional bridge running with `commands.enabled = true`
235
+
236
+ ## Examples
237
+
238
+ ### Automated DJ
239
+
240
+ Add a list of videos:
241
+ ```bash
242
+ for url in $(cat playlist.txt); do
243
+ kryten playlist add "$url"
244
+ sleep 1
245
+ done
246
+ ```
247
+
248
+ ### Bot Integration
249
+
250
+ Use in scripts to respond to events:
251
+ ```bash
252
+ #!/bin/bash
253
+ # Greet new users
254
+ kryten say "Welcome to the channel!"
255
+ ```
256
+
257
+ ### Remote Moderation
258
+
259
+ Quick moderation commands:
260
+ ```bash
261
+ kryten kick TrollUser "Please follow the rules"
262
+ kryten ban SpamBot "Automated spam detected"
263
+ ```
264
+
265
+ ## Troubleshooting
266
+
267
+ ### Connection refused
268
+
269
+ Make sure NATS server is running:
270
+ ```bash
271
+ # Start NATS server
272
+ nats-server
273
+ ```
274
+
275
+ ### Command not found
276
+
277
+ Make sure the CLI is installed:
278
+ ```bash
279
+ pip install -e .
280
+ ```
281
+
282
+ Or use the module directly:
283
+ ```bash
284
+ python kryten_cli.py say "Hello"
285
+ ```
286
+
287
+ ### Commands not executing
288
+
289
+ 1. Check that Kryten bridge is running
290
+ 2. Verify `commands.enabled = true` in Kryten's config
291
+ 3. Check NATS connection settings match between CLI and Kryten
292
+ 4. Verify channel name is correct
293
+
294
+ ## Version 2.0 - Using kryten-py Library
295
+
296
+ **Version 2.0** is a complete rewrite that uses the `kryten-py` library instead of direct NATS calls. This provides:
297
+
298
+ - **Cleaner code**: High-level API instead of low-level NATS
299
+ - **Type safety**: Typed interfaces and better IDE support
300
+ - **Better maintenance**: Shares code with other kryten projects
301
+ - **New features**: Automatic URL parsing for media commands
302
+
303
+ For migration information from v1.x, see [MIGRATION.md](MIGRATION.md).
304
+
305
+ For complete details about the refactor, see [REFACTOR_SUMMARY.md](REFACTOR_SUMMARY.md).
306
+
307
+ ## Contributing
308
+
309
+ This project serves as a reference implementation for using kryten-py. Contributions are welcome!
310
+
311
+ ## License
312
+
313
+ See LICENSE file for details.
@@ -0,0 +1,282 @@
1
+ # Kryten CLI
2
+
3
+ Command-line client for sending CyTube commands via the kryten-py library.
4
+
5
+ ## Overview
6
+
7
+ This CLI provides a simple command-line interface to control CyTube channels through the Kryten bridge. It uses the high-level `kryten-py` library for all communication, making it a clean and maintainable reference implementation.
8
+
9
+ ## Installation
10
+
11
+ Install the CLI tool:
12
+
13
+ ```bash
14
+ pip install -e .
15
+ ```
16
+
17
+ This will automatically install the `kryten-py` dependency.
18
+
19
+ Or run directly:
20
+
21
+ ```bash
22
+ python kryten_cli.py --help
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ The CLI reads connection settings from `config.json` in the current directory. Create one with your NATS server and CyTube channel:
28
+
29
+ ```json
30
+ {
31
+ "nats": {
32
+ "servers": ["nats://localhost:4222"]
33
+ },
34
+ "channels": [
35
+ {
36
+ "domain": "cytu.be",
37
+ "channel": "your-channel-name"
38
+ }
39
+ ]
40
+ }
41
+ ```
42
+
43
+ **Legacy Format Support:** The CLI also supports the older config format with `cytube.channel` for backward compatibility.
44
+
45
+ You can also specify a different config file:
46
+
47
+ ```bash
48
+ kryten --config /path/to/config.json say "Hello"
49
+ ```
50
+
51
+ ## Usage Examples
52
+
53
+ ### Chat Commands
54
+
55
+ Send a chat message:
56
+ ```bash
57
+ kryten say "Hello world"
58
+ ```
59
+
60
+ Send a private message:
61
+ ```bash
62
+ kryten pm UserName "Hi there!"
63
+ ```
64
+
65
+ ### Playlist Commands
66
+
67
+ Add video to end of playlist:
68
+ ```bash
69
+ kryten playlist add https://youtube.com/watch?v=xyz
70
+ kryten playlist add yt:abc123
71
+ ```
72
+
73
+ Add video to play next:
74
+ ```bash
75
+ kryten playlist addnext https://youtube.com/watch?v=abc
76
+ ```
77
+
78
+ Add as temporary (auto-deleted after playing):
79
+ ```bash
80
+ kryten playlist add --temp https://youtube.com/watch?v=xyz
81
+ ```
82
+
83
+ Delete video from playlist:
84
+ ```bash
85
+ kryten playlist del video-uid-123
86
+ ```
87
+
88
+ Move video in playlist:
89
+ ```bash
90
+ kryten playlist move video-uid-5 after video-uid-3
91
+ ```
92
+
93
+ Jump to specific video:
94
+ ```bash
95
+ kryten playlist jump video-uid-7
96
+ ```
97
+
98
+ Clear entire playlist:
99
+ ```bash
100
+ kryten playlist clear
101
+ ```
102
+
103
+ Shuffle playlist:
104
+ ```bash
105
+ kryten playlist shuffle
106
+ ```
107
+
108
+ Set video temporary status:
109
+ ```bash
110
+ kryten playlist settemp video-uid-5 true
111
+ kryten playlist settemp video-uid-5 false
112
+ ```
113
+
114
+ ### Playback Commands
115
+
116
+ Pause current video:
117
+ ```bash
118
+ kryten pause
119
+ ```
120
+
121
+ Resume playback:
122
+ ```bash
123
+ kryten play
124
+ ```
125
+
126
+ Seek to timestamp (in seconds):
127
+ ```bash
128
+ kryten seek 120.5
129
+ ```
130
+
131
+ ### Moderation Commands
132
+
133
+ Kick user:
134
+ ```bash
135
+ kryten kick UserName
136
+ kryten kick UserName "Stop spamming"
137
+ ```
138
+
139
+ Ban user:
140
+ ```bash
141
+ kryten ban UserName
142
+ kryten ban UserName "Banned for harassment"
143
+ ```
144
+
145
+ Vote to skip current video:
146
+ ```bash
147
+ kryten voteskip
148
+ ```
149
+
150
+ ## Command Reference
151
+
152
+ | Command | Description |
153
+ |---------|-------------|
154
+ | `say <message>` | Send a chat message |
155
+ | `pm <user> <message>` | Send a private message |
156
+ | `playlist add <url>` | Add video to end of playlist |
157
+ | `playlist addnext <url>` | Add video to play next |
158
+ | `playlist del <uid>` | Delete video from playlist |
159
+ | `playlist move <uid> after <uid>` | Move video in playlist |
160
+ | `playlist jump <uid>` | Jump to specific video |
161
+ | `playlist clear` | Clear entire playlist |
162
+ | `playlist shuffle` | Shuffle playlist |
163
+ | `playlist settemp <uid> <true\|false>` | Set temporary status |
164
+ | `pause` | Pause playback |
165
+ | `play` | Resume playback |
166
+ | `seek <seconds>` | Seek to timestamp |
167
+ | `kick <user> [reason]` | Kick user from channel |
168
+ | `ban <user> [reason]` | Ban user from channel |
169
+ | `voteskip` | Vote to skip current video |
170
+
171
+ ## Options
172
+
173
+ | Option | Description |
174
+ |--------|-------------|
175
+ | `--config <path>` | Path to config file (default: config.json) |
176
+ | `--channel <name>` | Override channel from config |
177
+ | `--help` | Show help message |
178
+
179
+ ## NATS Message Format
180
+
181
+ All commands are published to NATS subjects following this pattern:
182
+
183
+ ```
184
+ cytube.commands.{channel}.{action}
185
+ ```
186
+
187
+ Message payload:
188
+ ```json
189
+ {
190
+ "action": "chat",
191
+ "data": {
192
+ "message": "Hello world"
193
+ }
194
+ }
195
+ ```
196
+
197
+ This format is compatible with the Kryten bidirectional bridge's `CommandSubscriber`.
198
+
199
+ ## Requirements
200
+
201
+ - Python 3.11+
202
+ - nats-py >= 2.9.0
203
+ - Kryten bidirectional bridge running with `commands.enabled = true`
204
+
205
+ ## Examples
206
+
207
+ ### Automated DJ
208
+
209
+ Add a list of videos:
210
+ ```bash
211
+ for url in $(cat playlist.txt); do
212
+ kryten playlist add "$url"
213
+ sleep 1
214
+ done
215
+ ```
216
+
217
+ ### Bot Integration
218
+
219
+ Use in scripts to respond to events:
220
+ ```bash
221
+ #!/bin/bash
222
+ # Greet new users
223
+ kryten say "Welcome to the channel!"
224
+ ```
225
+
226
+ ### Remote Moderation
227
+
228
+ Quick moderation commands:
229
+ ```bash
230
+ kryten kick TrollUser "Please follow the rules"
231
+ kryten ban SpamBot "Automated spam detected"
232
+ ```
233
+
234
+ ## Troubleshooting
235
+
236
+ ### Connection refused
237
+
238
+ Make sure NATS server is running:
239
+ ```bash
240
+ # Start NATS server
241
+ nats-server
242
+ ```
243
+
244
+ ### Command not found
245
+
246
+ Make sure the CLI is installed:
247
+ ```bash
248
+ pip install -e .
249
+ ```
250
+
251
+ Or use the module directly:
252
+ ```bash
253
+ python kryten_cli.py say "Hello"
254
+ ```
255
+
256
+ ### Commands not executing
257
+
258
+ 1. Check that Kryten bridge is running
259
+ 2. Verify `commands.enabled = true` in Kryten's config
260
+ 3. Check NATS connection settings match between CLI and Kryten
261
+ 4. Verify channel name is correct
262
+
263
+ ## Version 2.0 - Using kryten-py Library
264
+
265
+ **Version 2.0** is a complete rewrite that uses the `kryten-py` library instead of direct NATS calls. This provides:
266
+
267
+ - **Cleaner code**: High-level API instead of low-level NATS
268
+ - **Type safety**: Typed interfaces and better IDE support
269
+ - **Better maintenance**: Shares code with other kryten projects
270
+ - **New features**: Automatic URL parsing for media commands
271
+
272
+ For migration information from v1.x, see [MIGRATION.md](MIGRATION.md).
273
+
274
+ For complete details about the refactor, see [REFACTOR_SUMMARY.md](REFACTOR_SUMMARY.md).
275
+
276
+ ## Contributing
277
+
278
+ This project serves as a reference implementation for using kryten-py. Contributions are welcome!
279
+
280
+ ## License
281
+
282
+ See LICENSE file for details.
@@ -0,0 +1,19 @@
1
+ {
2
+ "nats": {
3
+ "servers": ["nats://localhost:4222"],
4
+ "user": null,
5
+ "password": null,
6
+ "token": null,
7
+ "connect_timeout": 10,
8
+ "reconnect_time_wait": 2,
9
+ "max_reconnect_attempts": 10,
10
+ "ping_interval": 120
11
+ },
12
+ "channels": [
13
+ {
14
+ "domain": "cytu.be",
15
+ "channel": "your-channel-name"
16
+ }
17
+ ],
18
+ "log_level": "INFO"
19
+ }