From a11fa2628f1e323663cd232350a0ca025ed9a4b3 Mon Sep 17 00:00:00 2001 From: Dang Mai Date: Thu, 13 Oct 2022 15:09:34 -0700 Subject: [PATCH 1/3] Build types from custom commit --- scripts/build-types.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/build-types.ts b/scripts/build-types.ts index 12c8831..144abcc 100644 --- a/scripts/build-types.ts +++ b/scripts/build-types.ts @@ -77,11 +77,14 @@ const headers = { Authorization: process.env.GH_TOKEN ? `token ${process.env.GH_TOKEN}` : undefined, }; -const {body: release} = await got('https://api.github.com/repos/obsproject/obs-websocket/releases/latest', { - headers, - responseType: 'json', -}); -const commit = (release as JsonObject).tag_name as string; +let commit = process.env.GH_COMMIT +if (!commit) { + const {body: release} = await got('https://api.github.com/repos/obsproject/obs-websocket/releases/latest', { + headers, + responseType: 'json', + }); + commit = (release as JsonObject).tag_name as string; +} const {body: protocol} = await got(`https://raw.githubusercontent.com/obsproject/obs-websocket/${commit}/docs/generated/protocol.json`, { headers, From d2a6a69a6e27a60cdc1228fa04d59470d5d927b3 Mon Sep 17 00:00:00 2001 From: Dang Mai Date: Thu, 13 Oct 2022 15:10:13 -0700 Subject: [PATCH 2/3] Updates types from obs-websocket 5.0.2 --- src/types.ts | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 152 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index aae0dba..0ddf862 100644 --- a/src/types.ts +++ b/src/types.ts @@ -140,7 +140,7 @@ export enum EventSubscription { * * Initial OBS Version: 5.0.0 */ - All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors), + All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors | Ui), /** * Subscription value to receive the `InputVolumeMeters` high-volume event. * @@ -629,6 +629,10 @@ export interface OBSEventTypes { * The specific state of the output */ outputState: string; + /** + * File name for the saved recording, if record stopped. `null` otherwise + */ + outputPath: string; }; ReplayBufferStateChanged: { /** @@ -1460,6 +1464,47 @@ export interface OBSRequestTypes { StopReplayBuffer: never; SaveReplayBuffer: never; GetLastReplayBufferReplay: never; + GetOutputList: never; + GetOutputStatus: { + /** + * Output name + */ + outputName: string; + }; + ToggleOutput: { + /** + * Output name + */ + outputName: string; + }; + StartOutput: { + /** + * Output name + */ + outputName: string; + }; + StopOutput: { + /** + * Output name + */ + outputName: string; + }; + GetOutputSettings: { + /** + * Output name + */ + outputName: string; + }; + SetOutputSettings: { + /** + * Output name + */ + outputName: string; + /** + * Output settings + */ + outputSettings: JsonObject; + }; GetRecordStatus: never; ToggleRecord: never; StartRecord: never; @@ -1900,6 +1945,42 @@ export interface OBSRequestTypes { inputName: string; }; GetMonitorList: never; + OpenVideoMixProjector: { + /** + * Type of mix to open + */ + videoMixType: string; + /** + * Monitor index, use `GetMonitorList` to obtain index + * + * @defaultValue -1: Opens projector in windowed mode + */ + monitorIndex?: number; + /** + * Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + * + * @defaultValue N/A + */ + projectorGeometry?: string; + }; + OpenSourceProjector: { + /** + * Name of the source to open a projector for + */ + sourceName: string; + /** + * Monitor index, use `GetMonitorList` to obtain index + * + * @defaultValue -1: Opens projector in windowed mode + */ + monitorIndex?: number; + /** + * Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + * + * @defaultValue N/A + */ + projectorGeometry?: string; + }; } export interface OBSResponseTypes { @@ -2104,6 +2185,14 @@ export interface OBSResponseTypes { }; BroadcastCustomEvent: undefined; CallVendorRequest: { + /** + * Echoed of `vendorName` + */ + vendorName: string; + /** + * Echoed of `requestType` + */ + requestType: string; /** * Object containing appropriate response data. {} if request does not provide any response data */ @@ -2292,6 +2381,56 @@ export interface OBSResponseTypes { */ savedReplayPath: string; }; + GetOutputList: undefined; + GetOutputStatus: { + /** + * Whether the output is active + */ + outputActive: boolean; + /** + * Whether the output is reconnecting + */ + outputReconnecting: boolean; + /** + * Current formatted timecode string for the output + */ + outputTimecode: string; + /** + * Current duration in milliseconds for the output + */ + outputDuration: number; + /** + * Congestion of the output + */ + outputCongestion: number; + /** + * Number of bytes sent by the output + */ + outputBytes: number; + /** + * Number of frames skipped by the output's process + */ + outputSkippedFrames: number; + /** + * Total number of frames delivered by the output's process + */ + outputTotalFrames: number; + }; + ToggleOutput: { + /** + * Whether the output is active + */ + outputActive: boolean; + }; + StartOutput: undefined; + StopOutput: undefined; + GetOutputSettings: { + /** + * Output settings + */ + outputSettings: JsonObject; + }; + SetOutputSettings: undefined; GetRecordStatus: { /** * Whether the output is active @@ -2316,7 +2455,12 @@ export interface OBSResponseTypes { }; ToggleRecord: undefined; StartRecord: undefined; - StopRecord: undefined; + StopRecord: { + /** + * File name for the saved recording + */ + outputPath: string; + }; ToggleRecordPause: undefined; PauseRecord: undefined; ResumeRecord: undefined; @@ -2473,6 +2617,10 @@ export interface OBSResponseTypes { * Current duration in milliseconds for the output */ outputDuration: number; + /** + * Congestion of the output + */ + outputCongestion: number; /** * Number of bytes sent by the output */ @@ -2568,4 +2716,6 @@ export interface OBSResponseTypes { */ monitors: JsonObject[]; }; + OpenVideoMixProjector: undefined; + OpenSourceProjector: undefined; } From 36d4f1b8e7c36688e68c6529baac17e6c5abaf4c Mon Sep 17 00:00:00 2001 From: t2t2 Date: Sun, 13 Nov 2022 18:05:35 +0200 Subject: [PATCH 3/3] Allow also passing the commit via args example: `npm run generate:obs-types master` = `GH_COMMIT=master npm run generate:obs-types` --- scripts/build-types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-types.ts b/scripts/build-types.ts index 144abcc..629e557 100644 --- a/scripts/build-types.ts +++ b/scripts/build-types.ts @@ -77,7 +77,7 @@ const headers = { Authorization: process.env.GH_TOKEN ? `token ${process.env.GH_TOKEN}` : undefined, }; -let commit = process.env.GH_COMMIT +let commit = process.argv[2] ?? process.env.GH_COMMIT; if (!commit) { const {body: release} = await got('https://api.github.com/repos/obsproject/obs-websocket/releases/latest', { headers,