mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Protocol: add request types to get/set current recording folder
This commit is contained in:
parent
f49980350a
commit
f001d18eea
22
PROTOCOL.md
22
PROTOCOL.md
@ -73,6 +73,8 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
||||
- ["StartRecording"](#startrecording)
|
||||
- ["StopRecording"](#stoprecording)
|
||||
- ["GetStreamingStatus"](#getstreamingstatus)
|
||||
- ["SetRecordingFolder"](#setrecordingfolder)
|
||||
- ["GetRecordingFolder"](#getrecordingfolder)
|
||||
- **Transitions**
|
||||
- ["GetTransitionList"](#gettransitionlist)
|
||||
- ["GetCurrentTransition"](#getcurrenttransition)
|
||||
@ -519,6 +521,26 @@ __Response__ : Error if recording is already inactive, OK otherwise. No addition
|
||||
|
||||
---
|
||||
|
||||
#### "SetRecordingFolder"
|
||||
Change the current recording folder.
|
||||
|
||||
__Request fields__ :
|
||||
- **"rec-folder"** (string) : path of the desired recording folder
|
||||
|
||||
__Response__ : OK if path is valid, error otherwise.
|
||||
|
||||
---
|
||||
|
||||
#### "GetRecordingFolder"
|
||||
Get the path of the current recording folder.
|
||||
|
||||
__Request fields__ : none
|
||||
|
||||
__Response__ : OK with these additional fields :
|
||||
- **"rec-folder"** (string) : path of the current recording folder
|
||||
|
||||
---
|
||||
|
||||
#### "GetStreamingStatus"
|
||||
Get current streaming and recording status.
|
||||
|
||||
|
@ -57,6 +57,9 @@ WSRequestHandler::WSRequestHandler(QWebSocket* client) :
|
||||
messageMap["StartRecording"] = WSRequestHandler::HandleStartRecording;
|
||||
messageMap["StopRecording"] = WSRequestHandler::HandleStopRecording;
|
||||
|
||||
messageMap["SetRecordingFolder"] = WSRequestHandler::HandleSetRecordingFolder;
|
||||
messageMap["GetRecordingFolder"] = WSRequestHandler::HandleGetRecordingFolder;
|
||||
|
||||
messageMap["GetTransitionList"] = WSRequestHandler::HandleGetTransitionList;
|
||||
messageMap["GetCurrentTransition"] = WSRequestHandler::HandleGetCurrentTransition;
|
||||
messageMap["SetCurrentTransition"] = WSRequestHandler::HandleSetCurrentTransition;
|
||||
@ -1063,3 +1066,31 @@ void WSRequestHandler::HandleGetSpecialSources(WSRequestHandler* req)
|
||||
|
||||
obs_data_release(response);
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleSetRecordingFolder(WSRequestHandler* req)
|
||||
{
|
||||
if (!req->hasField("rec-folder"))
|
||||
{
|
||||
req->SendErrorResponse("missing request parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
const char* newRecFolder = obs_data_get_string(req->data, "rec-folder");
|
||||
bool success = Utils::SetRecordingFolder(newRecFolder);
|
||||
|
||||
if (success)
|
||||
req->SendOKResponse();
|
||||
else
|
||||
req->SendErrorResponse("invalid request parameters");
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleGetRecordingFolder(WSRequestHandler* req)
|
||||
{
|
||||
const char* recFolder = Utils::GetRecordingFolder();
|
||||
|
||||
obs_data_t* response = obs_data_create();
|
||||
obs_data_set_string(response, "rec-folder", recFolder);
|
||||
|
||||
req->SendOKResponse(response);
|
||||
obs_data_release(response);
|
||||
}
|
@ -67,6 +67,9 @@ class WSRequestHandler : public QObject
|
||||
static void HandleStartRecording(WSRequestHandler* req);
|
||||
static void HandleStopRecording(WSRequestHandler* req);
|
||||
|
||||
static void HandleSetRecordingFolder(WSRequestHandler* req);
|
||||
static void HandleGetRecordingFolder(WSRequestHandler* req);
|
||||
|
||||
static void HandleGetTransitionList(WSRequestHandler* req);
|
||||
static void HandleGetCurrentTransition(WSRequestHandler* req);
|
||||
static void HandleSetCurrentTransition(WSRequestHandler* req);
|
||||
|
Loading…
x
Reference in New Issue
Block a user