Skip to content

Commit 099afb5

Browse files
'SendStreamCaption, GetRecordDirectory, ScreenshotSaved'
1 parent 5749be8 commit 099afb5

23 files changed

+288
-52
lines changed

.github/workflows/dart.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ name: Dart
77

88
on:
99
push:
10-
branches: [ master ]
10+
branches: [master]
1111
pull_request:
12-
branches: [ master ]
12+
branches: [master]
1313

1414
jobs:
15+
pana:
16+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
17+
1518
build:
1619
runs-on: ubuntu-latest
1720

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 5.1.0
4+
5+
* stream
6+
* SendStreamCaption
7+
* config
8+
* GetRecordDirectory
9+
* ui event
10+
* ScreenshotSaved
11+
* commands
12+
* stream
13+
* SendStreamCaption
14+
* config
15+
* GetRecordDirectory
16+
317
## 5.0.0+15
418

519
* fix publish_tools dependency

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In your project add the dependency:
4545
```yml
4646
dependencies:
4747
...
48-
obs_websocket: ^5.0.0+15
48+
obs_websocket: ^5.1.0
4949
```
5050
5151
For help getting started with dart, check out these [guides](https://dart.dev/guides).
@@ -231,7 +231,7 @@ For any of the items that have an [x] from the list below, a high level helper c
231231
- [x] [ToggleStream](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#togglestream) - Toggles the status of the stream output.
232232
- [x] [StartStream](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#startstream) - Starts the stream output.
233233
- [x] [StopStream](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#stopstream) - Stops the stream output.
234-
- [ ] [SendStreamCaption](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#sendstreamcaption)
234+
- [x] [SendStreamCaption](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#sendstreamcaption) - Sends CEA-608 caption text over the stream output.
235235
- [Record Requests](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#record-requests) - `obsWebSocket.record`
236236
- [x] [GetRecordStatus](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#getrecordstatus) - Gets the status of the record output.
237237
- [x] [ToggleRecord](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#togglerecord) - Toggles the status of the record output.
@@ -450,7 +450,8 @@ if (!sceneItemEnabled) {
450450
- [ ] [MediaInputActionTriggered](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#mediainputactiontriggered)
451451
- [Ui Events](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#ui-events)
452452
- [x] [StudioModeStateChanged](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#studiomodestatechanged) - Studio mode has been enabled or disabled.
453-
453+
- [x] [ScreenshotSaved](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#screenshotsaved) - A screenshot has been saved.
454+
454455
### Handling events not yet supported
455456

456457
You can supply a `fallbackEvent` to the `ObsWebSocket` constructor to handle events that are not yet supported directly in the code. The following code snippet provides an example of this.

bin/README.md

Lines changed: 70 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,44 @@
22
# Easy OBS WebSocket CLI
33

44
A command line interface for controlling OBS with cli commands
5+
56
- [Installation](#installation)
67
- [Quick start](#quick-start)
78
- [Available Commands](#available-commands)
8-
- [authorize](#authorize)
9-
- [config](#config)
10-
- [config get-stream-service-settings](#config-get-stream-service-settings)
11-
- [config get-video-settings](#config-get-video-settings)
12-
- [config set-stream-service-settings](#config-set-stream-service-settings)
13-
- [config set-video-settings](#config-set-video-settings)
14-
- [general](#general)
15-
- [general get-stats](#general-get-stats)
16-
- [general get-version](#general-get-version)
17-
- [listen](#listen)
18-
- [send](#send)
19-
- [sources](#sources)
20-
- [sources get-source-active](#sources-get-source-active)
21-
- [sources get-source-screenshot](#sources-get-source-screenshot)
22-
- [sources save-source-screenshot](#sources-save-source-screenshot)
23-
- [stream](#stream)
24-
- [stream get-stream-status](#stream-get-stream-status)
25-
- [stream start-streaming](#stream-start-streaming)
26-
- [stream stop-streaming](#stream-stop-streaming)
27-
- [stream toggle-stream](#stream-toggle-stream)
28-
- [ui](#ui)
29-
- [ui get-monitor-list](#ui-get-monitor-list)
30-
- [ui get-studio-mode-enabled](#ui-get-studio-mode-enabled)
31-
- [ui set-studio-mode-enabled](#ui-set-studio-mode-enabled)
32-
- [version](#version)
9+
- [authorize](#authorize)
10+
- [config](#config)
11+
- [config get-record-directory](#config-get-record-directory)
12+
- [config get-stream-service-settings](#config-get-stream-service-settings)
13+
- [config get-video-settings](#config-get-video-settings)
14+
- [config set-stream-service-settings](#config-set-stream-service-settings)
15+
- [config set-video-settings](#config-set-video-settings)
16+
- [general](#general)
17+
- [general get-stats](#general-get-stats)
18+
- [general get-version](#general-get-version)
19+
- [listen](#listen)
20+
- [scene-items](#scene-items)
21+
- [scene-items get-scene-item-list](#scene-items-get-scene-item-list)
22+
- [scene-items get-scene-item-locked](#scene-items-get-scene-item-locked)
23+
- [scene-items set-scene-item-locked](#scene-items-set-scene-item-locked)
24+
- [send](#send)
25+
- [sources](#sources)
26+
- [sources get-source-active](#sources-get-source-active)
27+
- [sources get-source-screenshot](#sources-get-source-screenshot)
28+
- [sources save-source-screenshot](#sources-save-source-screenshot)
29+
- [stream](#stream)
30+
- [stream get-stream-status](#stream-get-stream-status)
31+
- [stream send-stream-caption](#stream-send-stream-caption)
32+
- [stream start-streaming](#stream-start-streaming)
33+
- [stream stop-streaming](#stream-stop-streaming)
34+
- [stream toggle-stream](#stream-toggle-stream)
35+
- [ui](#ui)
36+
- [ui get-monitor-list](#ui-get-monitor-list)
37+
- [ui get-studio-mode-enabled](#ui-get-studio-mode-enabled)
38+
- [ui set-studio-mode-enabled](#ui-set-studio-mode-enabled)
39+
- [version](#version)
3340
- [Advanced Usage](#advanced-usage)
34-
- [Subscribing to an OBS event](#subscribing-to-an-obs-event)
35-
- [Trigger a shell command for an OBS event](#trigger-a-shell-command-for-an-obs-event)
36-
41+
- [Subscribing to an OBS event](#subscribing-to-an-obs-event)
42+
- [Trigger a shell command for an OBS event](#trigger-a-shell-command-for-an-obs-event)
3743

3844
## Installation
3945

@@ -170,12 +176,27 @@ Usage: obs config <subcommand> [arguments]
170176
-h, --help Print this usage information.
171177
172178
Available subcommands:
179+
get-record-directory Gets the current directory that the record output is set to.
173180
get-stream-service-settings Gets the current stream service settings (stream destination).
174181
get-video-settings Gets the current video settings.
175182
set-stream-service-settings Sets the current stream service settings (stream destination).
176183
set-video-settings Sets the current video settings.
177184
```
178185

186+
#### config get-record-directory
187+
188+
```sh
189+
obs config get-record-directory --help
190+
```
191+
192+
```text
193+
Gets the current directory that the record output is set to.
194+
195+
Usage: obs config get-record-directory [arguments]
196+
-h, --help Print this usage information.
197+
```
198+
199+
179200
#### config get-stream-service-settings
180201

181202
```sh
@@ -186,6 +207,7 @@ obs config get-stream-service-settings --help
186207
Gets the current stream service settings (stream destination).
187208
188209
Usage: obs config get-stream-service-settings [arguments]
210+
-h, --help Print this usage information.
189211
```
190212

191213
#### config get-video-settings
@@ -198,6 +220,7 @@ obs config get-video-settings --help
198220
Gets the current video settings.
199221
200222
Usage: obs config get-video-settings [arguments]
223+
-h, --help Print this usage information.
201224
```
202225

203226
#### config set-stream-service-settings
@@ -465,10 +488,11 @@ Usage: obs stream <subcommand> [arguments]
465488
-h, --help Print this usage information.
466489
467490
Available subcommands:
468-
get-stream-status Gets the status of the stream output.
469-
start-streaming Starts the stream output.
470-
stop-streaming Stops the stream output.
471-
toggle-stream Toggles the status of the stream output.
491+
get-stream-status Gets the status of the stream output.
492+
send-stream-caption Sends CEA-608 caption text over the stream output.
493+
start-streaming Starts the stream output.
494+
stop-streaming Stops the stream output.
495+
toggle-stream Toggles the status of the stream output.
472496
```
473497

474498
#### stream get-stream-status
@@ -484,6 +508,20 @@ Usage: obs stream get-stream-status [arguments]
484508
-h, --help Print this usage information.
485509
```
486510

511+
#### stream send-stream-caption
512+
513+
```sh
514+
obs stream send-stream-caption --help
515+
```
516+
517+
```text
518+
Sends CEA-608 caption text over the stream output.
519+
520+
Usage: obs stream send-stream-caption [arguments]
521+
-h, --help Print this usage information.
522+
--caption-Text=<string> (mandatory) Caption text
523+
```
524+
487525
#### stream start-streaming
488526

489527
```sh

lib/meta.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
import 'dart:convert' show json;
44

55
final pubSpec = json.decode(
6-
'{"name":"obs_websocket","version":"5.0.0+15","homepage":"https://github.com/faithoflifedev/easy_obs_websocket","environment":{"sdk":">=2.17.3 <3.0.0"},"description":"obs_websocket allows dart-based connections to the OBS (Open Broadcaster Software) plugin obs-websocket","dependencies":{"args":"^2.3.1","crypto":"^3.0.2","json_annotation":"^4.7.0","loggy":"^2.0.3","uuid":"^3.0.7","universal_io":"^2.0.4","validators":"^3.0.0","web_socket_channel":"^2.2.0","yaml":"^3.1.1"},"dev_dependencies":{"build_runner":"^2.3.2","grinder":"^0.9.3","http":"^0.13.5","json_serializable":"^6.5.4","lints":"^2.0.1","mustache_template":"^2.0.0","path":"^1.8.2","process_run":"^0.12.3+2","pub_semver":"^2.1.3","pubspec":"^2.3.0","test":"^1.22.0","publish_tools":"^0.1.0+10"},"executables":{"obs":""},"repository":"https://github.com/faithoflifedev/easy_obs_websocket"}');
6+
'{"name":"obs_websocket","version":"5.1.0","homepage":"https://github.com/faithoflifedev/easy_obs_websocket","environment":{"sdk":">=2.17.3 <3.0.0"},"description":"obs_websocket allows dart-based connections to the OBS (Open Broadcaster Software) plugin obs-websocket","dependencies":{"args":"^2.4.0","crypto":"^3.0.2","json_annotation":"^4.8.0","loggy":"^2.0.3","uuid":"^3.0.7","universal_io":"^2.2.0","validators":"^3.0.0","web_socket_channel":"^2.3.0","yaml":"^3.1.1"},"dev_dependencies":{"build_runner":"^2.3.3","grinder":"^0.9.3","http":"^0.13.5","json_serializable":"^6.6.1","lints":"^2.0.1","mustache_template":"^2.0.0","path":"^1.8.3","process_run":"^0.12.5+2","pub_semver":"^2.1.3","pubspec":"^2.3.0","test":"^1.23.1","publish_tools":"^0.1.0+10"},"executables":{"obs":""},"repository":"https://github.com/faithoflifedev/easy_obs_websocket"}');

lib/obs_websocket.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export 'src/model/response/monitor_list_response.dart';
3131
export 'src/model/response/profile_list_response.dart';
3232
export 'src/model/response/profile_parameter_response.dart';
3333
export 'src/model/response/record_status_response.dart';
34+
export 'src/model/response/record_directory_response.dart';
3435
export 'src/model/response/scene_collection_list_response.dart';
3536
export 'src/model/response/scene_item_list_response.dart';
3637
export 'src/model/response/scene_list_response.dart';

lib/src/cmd/obs_config_command.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class ObsConfigCommand extends Command {
1919
addSubcommand(ObsSetVideoSettingsCommand());
2020
addSubcommand(ObsGetStreamServiceSettingsCommand());
2121
addSubcommand(ObsSetStreamServiceSettingsCommand());
22+
addSubcommand(ObsGetRecordDirectoryCommand());
2223
// addSubcommand(ObsGetHotkeyListCommand());
2324
// addSubcommand(ObsTriggerHotkeyByNameCommand());
2425
// addSubcommand(ObsTriggerHotkeyByKeySequenceCommand());
@@ -164,3 +165,22 @@ class ObsSetStreamServiceSettingsCommand extends ObsHelperCommand {
164165
obs.close();
165166
}
166167
}
168+
169+
/// Gets the current directory that the record output is set to.
170+
class ObsGetRecordDirectoryCommand extends ObsHelperCommand {
171+
@override
172+
String get description =>
173+
'Gets the current directory that the record output is set to.';
174+
175+
@override
176+
String get name => 'get-record-directory';
177+
178+
@override
179+
void run() async {
180+
await initializeObs();
181+
182+
final result = await obs.config.getRecordDirectory();
183+
184+
print(result.recordDirectory);
185+
}
186+
}

lib/src/cmd/obs_stream_command.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ObsStreamCommand extends Command {
1414
addSubcommand(ObsToggleStreamCommand());
1515
addSubcommand(ObsStartStreamCommand());
1616
addSubcommand(ObsStopStreamCommand());
17+
addSubcommand(ObsSendStreamCaptionCommand());
1718
}
1819
}
1920

@@ -90,3 +91,27 @@ class ObsStopStreamCommand extends ObsHelperCommand {
9091
obs.close();
9192
}
9293
}
94+
95+
/// Sends CEA-608 caption text over the stream output.
96+
class ObsSendStreamCaptionCommand extends ObsHelperCommand {
97+
@override
98+
String get description =>
99+
'Sends CEA-608 caption text over the stream output.';
100+
101+
@override
102+
String get name => 'send-stream-caption';
103+
104+
ObsSendStreamCaptionCommand() {
105+
argParser.addOption('caption-Text',
106+
mandatory: true, valueHelp: 'string', help: 'Caption text');
107+
}
108+
109+
@override
110+
void run() async {
111+
await initializeObs();
112+
113+
await obs.stream.sendStreamCaption(argResults!['caption-Text']);
114+
115+
obs.close();
116+
}
117+
}

lib/src/model/event/outputs/record_state_changed.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ import 'package:json_annotation/json_annotation.dart';
44

55
part 'record_state_changed.g.dart';
66

7+
/// The state of the record output has changed.
78
@JsonSerializable()
89
class RecordStateChanged {
10+
/// Whether the output is active
911
final bool outputActive;
12+
13+
/// The specific state of the output
1014
final String outputState;
15+
16+
/// File name for the saved recording, if record stopped. null otherwise
1117
final String outputPath;
1218

1319
RecordStateChanged({

lib/src/model/event/outputs/stream_state_changed.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import 'package:json_annotation/json_annotation.dart';
44

55
part 'stream_state_changed.g.dart';
66

7+
/// The state of the stream output has changed.
78
@JsonSerializable()
89
class StreamStateChanged {
10+
/// Whether the output is active
911
final bool outputActive;
12+
13+
/// The specific state of the output
1014
final String outputState;
1115

1216
StreamStateChanged({

0 commit comments

Comments
 (0)