2022-07-26 21:48:52 +01:00
|
|
|
import time
|
|
|
|
from re import S
|
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
from .baseclient import ObsClient
|
2022-07-26 21:48:52 +01:00
|
|
|
from .error import OBSSDKError
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
A class to interact with obs-websocket requests
|
|
|
|
defined in official github repo
|
|
|
|
https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#Requests
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
class ReqClient(object):
|
2022-07-25 23:51:30 +01:00
|
|
|
def __init__(self, **kwargs):
|
|
|
|
self.base_client = ObsClient(**kwargs)
|
2022-06-05 12:40:55 +01:00
|
|
|
self.base_client.authenticate()
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def getter(self, param):
|
|
|
|
response = self.base_client.req(param)
|
|
|
|
return response["responseData"]
|
|
|
|
|
|
|
|
def setter(self, param, data):
|
|
|
|
response = self.base_client.req(param, data)
|
|
|
|
if not response["requestStatus"]["result"]:
|
|
|
|
error = (
|
|
|
|
f"Request {response['requestType']} returned code {response['requestStatus']['code']}",
|
|
|
|
)
|
|
|
|
if "comment" in response["requestStatus"]:
|
|
|
|
error += (f"With message: {response['requestStatus']['comment']}",)
|
|
|
|
raise OBSSDKError("\n".join(error))
|
|
|
|
|
|
|
|
action = setter
|
|
|
|
|
|
|
|
def get_version(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets data about the current plugin and RPC version.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:return: The version info as a dictionary
|
|
|
|
:rtype: dict
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetVersion")
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_stats(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets statistics about OBS, obs-websocket, and the current session.
|
|
|
|
|
|
|
|
:return: The stats info as a dictionary
|
|
|
|
:rtype: dict
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetStats")
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def broadcast_custom_event(self, eventData):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Broadcasts a CustomEvent to all WebSocket clients. Receivers are clients which are identified and subscribed.
|
|
|
|
|
|
|
|
:param eventData: Data payload to emit to all receivers
|
|
|
|
:type eventData: object
|
|
|
|
:return: empty response
|
|
|
|
:rtype: str
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
self.action("BroadcastCustomEvent", eventData)
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def call_vendor_request(self, vendorName, requestType, requestData=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Call a request registered to a vendor.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
|
|
|
A vendor is a unique name registered by a
|
|
|
|
third-party plugin or script, which allows
|
2022-06-05 12:40:55 +01:00
|
|
|
for custom requests and events to be added
|
2022-07-25 23:51:30 +01:00
|
|
|
to obs-websocket. If a plugin or script
|
|
|
|
implements vendor requests or events,
|
2022-06-05 12:40:55 +01:00
|
|
|
documentation is expected to be provided with them.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param vendorName: Name of the vendor to use
|
|
|
|
:type vendorName: str
|
|
|
|
:param requestType: The request type to call
|
|
|
|
:type requestType: str
|
|
|
|
:param requestData: Object containing appropriate request data
|
2022-06-05 15:06:50 +01:00
|
|
|
:type requestData: dict, optional
|
2022-06-05 12:40:55 +01:00
|
|
|
:return: responseData
|
|
|
|
:rtype: dict
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
response = self.base_client.req(req_type=requestType, req_data=requestData)
|
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_hot_key_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets an array of all hotkey names in OBS
|
|
|
|
|
|
|
|
:return: hotkeys
|
|
|
|
:rtype: list[str]
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetHotkeyList")
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def trigger_hot_key_by_name(self, hotkeyName):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Triggers a hotkey using its name. For hotkey names
|
|
|
|
See GetHotkeyList
|
|
|
|
|
|
|
|
:param hotkeyName: Name of the hotkey to trigger
|
|
|
|
:type hotkeyName: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"hotkeyName": hotkeyName}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.action("TriggerHotkeyByName", payload)
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def trigger_hot_key_by_key_sequence(
|
2022-07-25 23:51:30 +01:00
|
|
|
self, keyId, pressShift, pressCtrl, pressAlt, pressCmd
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Triggers a hotkey using a sequence of keys.
|
|
|
|
|
|
|
|
:param keyId: The OBS key ID to use. See https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h
|
|
|
|
:type keyId: str
|
|
|
|
:param keyModifiers: Object containing key modifiers to apply.
|
|
|
|
:type keyModifiers: dict
|
|
|
|
:param keyModifiers.shift: Press Shift
|
|
|
|
:type keyModifiers.shift: bool
|
|
|
|
:param keyModifiers.control: Press CTRL
|
|
|
|
:type keyModifiers.control: bool
|
|
|
|
:param keyModifiers.alt: Press ALT
|
|
|
|
:type keyModifiers.alt: bool
|
|
|
|
:param keyModifiers.cmd: Press CMD (Mac)
|
|
|
|
:type keyModifiers.cmd: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"keyId": keyId,
|
|
|
|
"keyModifiers": {
|
|
|
|
"shift": pressShift,
|
|
|
|
"control": pressCtrl,
|
|
|
|
"alt": pressAlt,
|
|
|
|
"cmd": pressCmd,
|
|
|
|
},
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
|
|
|
|
response = self.base_client.req("TriggerHotkeyByKeySequence", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def sleep(self, sleepMillis=None, sleepFrames=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
Sleeps for a time duration or number of frames.
|
2022-06-05 12:40:55 +01:00
|
|
|
Only available in request batches with types SERIAL_REALTIME or SERIAL_FRAME
|
|
|
|
|
|
|
|
:param sleepMillis: Number of milliseconds to sleep for (if SERIAL_REALTIME mode) 0 <= sleepMillis <= 50000
|
|
|
|
:type sleepMillis: int
|
|
|
|
:param sleepFrames: Number of frames to sleep for (if SERIAL_FRAME mode) 0 <= sleepFrames <= 10000
|
|
|
|
:type sleepFrames: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sleepMillis": sleepMillis, "sleepFrames": sleepFrames}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.action("Sleep", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_persistent_data(self, realm, slotName):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the value of a "slot" from the selected persistent data realm.
|
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
:param realm: The data realm to select
|
2022-06-05 12:40:55 +01:00
|
|
|
OBS_WEBSOCKET_DATA_REALM_GLOBAL or OBS_WEBSOCKET_DATA_REALM_PROFILE
|
|
|
|
:type realm: str
|
|
|
|
:param slotName: The name of the slot to retrieve data from
|
|
|
|
:type slotName: str
|
|
|
|
:return: slotValue Value associated with the slot
|
|
|
|
:rtype: any
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"realm": realm, "slotName": slotName}
|
|
|
|
response = self.base_client.req("GetPersistentData", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_persistent_data(self, realm, slotName, slotValue):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the value of a "slot" from the selected persistent data realm.
|
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
:param realm: The data realm to select.
|
2022-06-05 12:40:55 +01:00
|
|
|
OBS_WEBSOCKET_DATA_REALM_GLOBAL or OBS_WEBSOCKET_DATA_REALM_PROFILE
|
|
|
|
:type realm: str
|
|
|
|
:param slotName: The name of the slot to retrieve data from
|
|
|
|
:type slotName: str
|
|
|
|
:param slotValue: The value to apply to the slot
|
|
|
|
:type slotValue: any
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"realm": realm, "slotName": slotName, "slotValue": slotValue}
|
|
|
|
response = self.base_client.req("SetPersistentData", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_collection_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets an array of all scene collections
|
|
|
|
|
|
|
|
:return: sceneCollections
|
|
|
|
:rtype: list[str]
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetSceneCollectionList")
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_scene_collection(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Switches to a scene collection.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param name: Name of the scene collection to switch to
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneCollectionName": name}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.setter("SetCurrentSceneCollection", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_scene_collection(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Creates a new scene collection, switching to it in the process.
|
|
|
|
Note: This will block until the collection has finished changing.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name for the new scene collection
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneCollectionName": name}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.action("CreateSceneCollection", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_profile_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all profiles
|
|
|
|
|
|
|
|
:return: profiles (List of all profiles)
|
|
|
|
:rtype: list[str]
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetProfileList")
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_profile(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Switches to a profile
|
|
|
|
|
|
|
|
:param name: Name of the profile to switch to
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"profileName": name}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.setter("SetCurrentProfile", payload)
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_profile(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Creates a new profile, switching to it in the process
|
|
|
|
|
|
|
|
:param name: Name for the new profile
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"profileName": name}
|
|
|
|
response = self.base_client.req("CreateProfile", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def remove_profile(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
Removes a profile. If the current profile is chosen,
|
2022-06-05 12:40:55 +01:00
|
|
|
it will change to a different profile first.
|
|
|
|
|
|
|
|
:param name: Name of the profile to remove
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"profileName": name}
|
|
|
|
response = self.base_client.req("RemoveProfile", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_profile_parameter(self, category, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Gets a parameter from the current profile's configuration.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param category: Category of the parameter to get
|
|
|
|
:type category: str
|
|
|
|
:param name: Name of the parameter to get
|
|
|
|
:type name: str
|
|
|
|
|
|
|
|
:return: Value and default value for the parameter
|
|
|
|
:rtype: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"parameterCategory": category, "parameterName": name}
|
|
|
|
response = self.base_client.req("GetProfileParameter", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_profile_parameter(self, category, name, value):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Sets the value of a parameter in the current profile's configuration.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param category: Category of the parameter to set
|
|
|
|
:type category: str
|
|
|
|
:param name: Name of the parameter to set
|
|
|
|
:type name: str
|
|
|
|
:param value: Value of the parameter to set. Use null to delete
|
|
|
|
:type value: str
|
|
|
|
|
|
|
|
:return: Value and default value for the parameter
|
|
|
|
:rtype: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"parameterCategory": category,
|
|
|
|
"parameterName": name,
|
|
|
|
"parameterValue": value,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetProfileParameter", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_video_settings(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the current video settings.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: To get the true FPS value, divide the FPS numerator by the FPS denominator.
|
2022-06-05 12:40:55 +01:00
|
|
|
Example: 60000/1001
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetVideoSettings")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_video_settings(
|
2022-07-25 23:51:30 +01:00
|
|
|
self, numerator, denominator, base_width, base_height, out_width, out_height
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the current video settings.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: Fields must be specified in pairs.
|
2022-06-05 12:40:55 +01:00
|
|
|
For example, you cannot set only baseWidth without needing to specify baseHeight.
|
|
|
|
|
|
|
|
:param numerator: Numerator of the fractional FPS value >=1
|
|
|
|
:type numerator: int
|
|
|
|
:param denominator: Denominator of the fractional FPS value >=1
|
|
|
|
:type denominator: int
|
|
|
|
:param base_width: Width of the base (canvas) resolution in pixels (>= 1, <= 4096)
|
|
|
|
:type base_width: int
|
|
|
|
:param base_height: Height of the base (canvas) resolution in pixels (>= 1, <= 4096)
|
|
|
|
:type base_height: int
|
|
|
|
:param out_width: Width of the output resolution in pixels (>= 1, <= 4096)
|
|
|
|
:type out_width: int
|
|
|
|
:param out_height: Height of the output resolution in pixels (>= 1, <= 4096)
|
|
|
|
:type out_height: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"fpsNumerator": numerator,
|
|
|
|
"fpsDenominator": denominator,
|
|
|
|
"baseWidth": base_width,
|
|
|
|
"baseHeight": base_height,
|
|
|
|
"outputWidth": out_width,
|
|
|
|
"outputHeight": out_height,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetVideoSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_stream_service_settings(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the current stream service settings (stream destination).
|
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetStreamServiceSettings")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_stream_service_settings(self, ss_type, ss_settings):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the current stream service settings (stream destination).
|
|
|
|
Note: Simple RTMP settings can be set with type rtmp_custom
|
|
|
|
and the settings fields server and key.
|
|
|
|
|
|
|
|
:param ss_type: Type of stream service to apply. Example: rtmp_common or rtmp_custom
|
|
|
|
:type ss_type: string
|
|
|
|
:param ss_setting: Settings to apply to the service
|
|
|
|
:type ss_setting: dict
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"streamServiceType": ss_type,
|
|
|
|
"streamServiceSettings": ss_settings,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetStreamServiceSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_source_active(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the active and show state of a source
|
|
|
|
|
|
|
|
:param name: Name of the source to get the active state of
|
|
|
|
:type name: str
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sourceName": name}
|
|
|
|
response = self.base_client.req("GetSourceActive", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_source_screenshot(self, name, img_format, width, height, quality):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a Base64-encoded screenshot of a source.
|
2022-07-25 23:51:30 +01:00
|
|
|
The imageWidth and imageHeight parameters are
|
|
|
|
treated as "scale to inner", meaning the smallest ratio
|
|
|
|
will be used and the aspect ratio of the original resolution is kept.
|
|
|
|
If imageWidth and imageHeight are not specified, the compressed image
|
2022-06-05 12:40:55 +01:00
|
|
|
will use the full resolution of the source.
|
|
|
|
|
|
|
|
:param name: Name of the source to take a screenshot of
|
|
|
|
:type name: str
|
|
|
|
:param format: Image compression format to use. Use GetVersion to get compatible image formats
|
|
|
|
:type format: str
|
|
|
|
:param width: Width to scale the screenshot to (>= 8, <= 4096)
|
|
|
|
:type width: int
|
|
|
|
:param height: Height to scale the screenshot to (>= 8, <= 4096)
|
|
|
|
:type height: int
|
|
|
|
:param quality: Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default"
|
|
|
|
:type quality: int
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": name,
|
|
|
|
"imageFormat": img_format,
|
|
|
|
"imageWidth": width,
|
|
|
|
"imageHeight": height,
|
|
|
|
"imageCompressionQuality": quality,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSourceScreenshot", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def save_source_screenshot(
|
|
|
|
self, name, img_format, file_path, width, height, quality
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Saves a Base64-encoded screenshot of a source.
|
2022-07-25 23:51:30 +01:00
|
|
|
The imageWidth and imageHeight parameters are
|
|
|
|
treated as "scale to inner", meaning the smallest ratio
|
|
|
|
will be used and the aspect ratio of the original resolution is kept.
|
|
|
|
If imageWidth and imageHeight are not specified, the compressed image
|
2022-06-05 12:40:55 +01:00
|
|
|
will use the full resolution of the source.
|
|
|
|
|
|
|
|
:param name: Name of the source to take a screenshot of
|
|
|
|
:type name: str
|
|
|
|
:param format: Image compression format to use. Use GetVersion to get compatible image formats
|
|
|
|
:type format: str
|
|
|
|
:param file_path: Path to save the screenshot file to. Eg. C:\\Users\\user\\Desktop\\screenshot.png
|
|
|
|
:type file_path: str
|
|
|
|
:param width: Width to scale the screenshot to (>= 8, <= 4096)
|
|
|
|
:type width: int
|
|
|
|
:param height: Height to scale the screenshot to (>= 8, <= 4096)
|
|
|
|
:type height: int
|
|
|
|
:param quality: Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default"
|
|
|
|
:type quality: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": name,
|
|
|
|
"imageFormat": img_format,
|
|
|
|
"imageFilePath": file_path,
|
|
|
|
"imageWidth": width,
|
|
|
|
"imageHeight": height,
|
|
|
|
"imageCompressionQuality": quality,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SaveSourceScreenshot", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all scenes in OBS.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetSceneList")
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_group_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all groups in OBS.
|
2022-07-25 23:51:30 +01:00
|
|
|
Groups in OBS are actually scenes,
|
|
|
|
but renamed and modified. In obs-websocket,
|
2022-06-05 12:40:55 +01:00
|
|
|
we treat them as scenes where we can..
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneList")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_current_program_scene(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-06-05 15:06:50 +01:00
|
|
|
Gets the current program scene.
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetCurrentProgramScene")
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_program_scene(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the current program scene
|
|
|
|
|
|
|
|
:param name: Scene to set as the current program scene
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
2022-07-26 21:48:52 +01:00
|
|
|
self.setter("SetCurrentProgramScene", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_current_preview_scene(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the current preview scene
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetCurrentPreviewScene")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_preview_scene(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the current program scene
|
|
|
|
|
|
|
|
:param name: Scene to set as the current preview scene
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("SetCurrentPreviewScene", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_scene(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Creates a new scene in OBS.
|
|
|
|
|
|
|
|
:param name: Name for the new scene
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("CreateScene", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def remove_scene(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Removes a scene from OBS
|
|
|
|
|
|
|
|
:param name: Name of the scene to remove
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("RemoveScene", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_name(self, old_name, new_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the name of a scene (rename).
|
|
|
|
|
|
|
|
:param old_name: Name of the scene to be renamed
|
|
|
|
:type old_name: str
|
|
|
|
:param new_name: New name for the scene
|
|
|
|
:type new_name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": old_name, "newSceneName": new_name}
|
|
|
|
response = self.base_client.req("SetSceneName", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_scene_transition_override(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the scene transition overridden for a scene.
|
|
|
|
|
|
|
|
:param name: Name of the scene
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("GetSceneSceneTransitionOverride", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_scene_transition_override(self, scene_name, tr_name, tr_duration):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the scene transition overridden for a scene.
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene
|
|
|
|
:type scene_name: str
|
|
|
|
:param tr_name: Name of the scene transition to use as override. Specify null to remove
|
|
|
|
:type tr_name: str
|
|
|
|
:param tr_duration: Duration to use for any overridden transition. Specify null to remove (>= 50, <= 20000)
|
|
|
|
:type tr_duration: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"transitionName": tr_name,
|
|
|
|
"transitionDuration": tr_duration,
|
|
|
|
}
|
|
|
|
response = self.base_client.req("SetSceneSceneTransitionOverride", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_list(self, kind):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all inputs in OBS.
|
|
|
|
|
|
|
|
:param kind: Restrict the list to only inputs of the specified kind
|
|
|
|
:type kind: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputKind": kind}
|
|
|
|
response = self.base_client.req("GetInputList", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_kind_list(self, unversioned):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all available input kinds in OBS.
|
|
|
|
|
|
|
|
:param unversioned: True == Return all kinds as unversioned, False == Return with version suffixes (if available)
|
|
|
|
:type unversioned: bool
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"unversioned": unversioned}
|
|
|
|
response = self.base_client.req("GetInputKindList", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_special_inputs(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-06-05 15:06:50 +01:00
|
|
|
Gets the name of all special inputs.
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSpecialInputs")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_input(
|
2022-07-25 23:51:30 +01:00
|
|
|
self, sceneName, inputName, inputKind, inputSettings, sceneItemEnabled
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Creates a new input, adding it as a scene item to the specified scene.
|
|
|
|
|
|
|
|
:param sceneName: Name of the scene to add the input to as a scene item
|
|
|
|
:type sceneName: str
|
|
|
|
:param inputName Name of the new input to created
|
|
|
|
:type inputName: str
|
|
|
|
:param inputKind: The kind of input to be created
|
|
|
|
:type inputKind: str
|
|
|
|
:param inputSettings: Settings object to initialize the input with
|
|
|
|
:type inputSettings: object
|
|
|
|
:param sceneItemEnabled: Whether to set the created scene item to enabled or disabled
|
|
|
|
:type sceneItemEnabled: bool
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": sceneName,
|
|
|
|
"inputName": inputName,
|
|
|
|
"inputKind": inputKind,
|
|
|
|
"inputSettings": inputSettings,
|
|
|
|
"sceneItemEnabled": sceneItemEnabled,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("CreateInput", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def remove_input(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Removes an existing input
|
|
|
|
|
|
|
|
:param name: Name of the input to remove
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("RemoveInput", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_name(self, old_name, new_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the name of an input (rename).
|
|
|
|
|
|
|
|
:param old_name: Current input name
|
|
|
|
:type old_name: str
|
|
|
|
:param new_name: New name for the input
|
|
|
|
:type new_name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": old_name, "newInputName": new_name}
|
|
|
|
response = self.base_client.req("SetInputName", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_default_settings(self, kind):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the default settings for an input kind.
|
|
|
|
|
|
|
|
:param kind: Input kind to get the default settings for
|
|
|
|
:type kind: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputKind": kind}
|
|
|
|
response = self.base_client.req("GetInputDefaultSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_settings(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the settings of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: Does not include defaults. To create the entire settings object,
|
2022-06-05 12:40:55 +01:00
|
|
|
overlay inputSettings over the defaultInputSettings provided by GetInputDefaultSettings.
|
|
|
|
|
|
|
|
:param name: Input kind to get the default settings for
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_settings(self, name, settings, overlay):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the settings of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to set the settings of
|
|
|
|
:type name: str
|
|
|
|
:param settings: Object of settings to apply
|
|
|
|
:type settings: dict
|
|
|
|
:param overlay: True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings.
|
|
|
|
:type overlay: bool
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "inputSettings": settings, "overlay": overlay}
|
|
|
|
response = self.base_client.req("SetInputSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_mute(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the audio mute state of an input
|
|
|
|
|
|
|
|
:param name: Name of input to get the mute state of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputMute", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_mute(self, name, muted):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the audio mute state of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to set the mute state of
|
|
|
|
:type name: str
|
|
|
|
:param muted: Whether to mute the input or not
|
|
|
|
:type muted: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "inputMuted": muted}
|
|
|
|
response = self.base_client.req("SetInputMute", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_input_mute(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles the audio mute state of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to toggle the mute state of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("ToggleInputMute", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_volume(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the current volume setting of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to get the volume of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputVolume", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_volume(self, name, vol_mul=None, vol_db=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the volume setting of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to set the volume of
|
|
|
|
:type name: str
|
|
|
|
:param vol_mul: Volume setting in mul (>= 0, <= 20)
|
|
|
|
:type vol_mul: int
|
|
|
|
:param vol_db: Volume setting in dB (>= -100, <= 26)
|
|
|
|
:type vol_db: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"inputName": name,
|
|
|
|
"inputVolumeMul": vol_mul,
|
|
|
|
"inputVolumeDb": vol_db,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetInputVolume", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_audio_balance(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the audio balance of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to get the audio balance of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputAudioBalance", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_audio_balance(self, name, balance):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the audio balance of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to get the audio balance of
|
|
|
|
:type name: str
|
|
|
|
:param balance: New audio balance value (>= 0.0, <= 1.0)
|
|
|
|
:type balance: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "inputAudioBalance": balance}
|
|
|
|
response = self.base_client.req("SetInputAudioBalance", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_audio_sync_offset(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the audio sync offset of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to get the audio sync offset of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
2022-07-26 21:48:52 +01:00
|
|
|
response = self.base_client.req("GetInputAudioSyncOffset", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_audio_sync_offset(self, name, offset):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the audio sync offset of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to set the audio sync offset of
|
|
|
|
:type name: str
|
|
|
|
:param offset: New audio sync offset in milliseconds (>= -950, <= 20000)
|
|
|
|
:type offset: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "inputAudioSyncOffset": offset}
|
|
|
|
response = self.base_client.req("SetInputAudioSyncOffset", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_audio_monitor_type(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the audio monitor type of an input.
|
|
|
|
|
|
|
|
The available audio monitor types are:
|
|
|
|
OBS_MONITORING_TYPE_NONE
|
|
|
|
OBS_MONITORING_TYPE_MONITOR_ONLY
|
|
|
|
OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT
|
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to get the audio monitor type of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputAudioMonitorType", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_audio_monitor_type(self, name, mon_type):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the audio monitor type of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input to set the audio monitor type of
|
|
|
|
:type name: str
|
|
|
|
:param mon_type: Audio monitor type
|
|
|
|
:type mon_type: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "monitorType": mon_type}
|
|
|
|
response = self.base_client.req("SetInputAudioMonitorType", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_audio_tracks(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the enable state of all audio tracks of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetInputAudioTracks", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_input_audio_tracks(self, name, track):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Sets the enable state of audio tracks of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
:param name: Name of the input
|
|
|
|
:type name: str
|
|
|
|
:param track: Track settings to apply
|
|
|
|
:type track: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "inputAudioTracks": track}
|
|
|
|
response = self.base_client.req("SetInputAudioTracks", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_input_properties_list_property_items(self, input_name, prop_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the items of a list property from an input's properties.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: Use this in cases where an input provides a dynamic,
|
|
|
|
selectable list of items. For example, display capture,
|
2022-06-05 12:40:55 +01:00
|
|
|
where it provides a list of available displays.
|
|
|
|
|
|
|
|
:param input_name: Name of the input
|
|
|
|
:type input_name: str
|
|
|
|
:param prop_name: Name of the list property to get the items of
|
|
|
|
:type prop_name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": input_name, "propertyName": prop_name}
|
|
|
|
response = self.base_client.req("GetInputPropertiesListPropertyItems", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def press_input_properties_button(self, input_name, prop_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Presses a button in the properties of an input.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: Use this in cases where there is a button
|
|
|
|
in the properties of an input that cannot be accessed in any other way.
|
2022-06-05 12:40:55 +01:00
|
|
|
For example, browser sources, where there is a refresh button.
|
|
|
|
|
|
|
|
:param input_name: Name of the input
|
|
|
|
:type input_name: str
|
|
|
|
:param prop_name: Name of the button property to press
|
|
|
|
:type prop_name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": input_name, "propertyName": prop_name}
|
|
|
|
response = self.base_client.req("PressInputPropertiesButton", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_transition_kind_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets an array of all available transition kinds.
|
|
|
|
Similar to GetInputKindList
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetTransitionKindList")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_transition_list(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets an array of all scene transitions in OBS.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneTransitionList")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_current_scene_transition(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets an array of all scene transitions in OBS.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetCurrentSceneTransition")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_scene_transition(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the current scene transition.
|
|
|
|
Small note: While the namespace of scene transitions is generally unique,
|
|
|
|
that uniqueness is not a guarantee as it is with other resources like inputs.
|
|
|
|
|
|
|
|
:param name: Name of the transition to make active
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"transitionName": name}
|
|
|
|
response = self.base_client.req("SetCurrentSceneTransition", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_scene_transition_duration(self, duration):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the duration of the current scene transition, if it is not fixed.
|
|
|
|
|
|
|
|
:param duration: Duration in milliseconds (>= 50, <= 20000)
|
|
|
|
:type duration: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"transitionDuration": duration}
|
|
|
|
response = self.base_client.req("SetCurrentSceneTransitionDuration", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_current_scene_transition_settings(self, settings, overlay=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the settings of the current scene transition.
|
|
|
|
|
|
|
|
:param settings: Settings object to apply to the transition. Can be {}
|
|
|
|
:type settings: dict
|
|
|
|
:param overlay: Whether to overlay over the current settings or replace them
|
|
|
|
:type overlay: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"transitionSettings": settings, "overlay": overlay}
|
|
|
|
response = self.base_client.req("SetCurrentSceneTransitionSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_current_scene_transition_cursor(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the cursor position of the current scene transition.
|
|
|
|
Note: transitionCursor will return 1.0 when the transition is inactive.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetCurrentSceneTransitionCursor")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def trigger_studio_mode_transition(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
Triggers the current scene transition.
|
2022-06-05 12:40:55 +01:00
|
|
|
Same functionality as the Transition button in studio mode.
|
2022-07-25 23:51:30 +01:00
|
|
|
Note: Studio mode should be active. if not throws an
|
2022-06-05 12:40:55 +01:00
|
|
|
RequestStatus::StudioModeNotActive (506) in response
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("TriggerStudioModeTransition")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_t_bar_position(self, pos, release=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the position of the TBar.
|
2022-07-25 23:51:30 +01:00
|
|
|
Very important note: This will be deprecated
|
2022-06-05 12:40:55 +01:00
|
|
|
and replaced in a future version of obs-websocket.
|
|
|
|
|
|
|
|
:param pos: New position (>= 0.0, <= 1.0)
|
|
|
|
:type pos: float
|
|
|
|
:param release: Whether to release the TBar. Only set false if you know that you will be sending another position update
|
|
|
|
:type release: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"position": pos, "release": release}
|
|
|
|
response = self.base_client.req("SetTBarPosition", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_source_filter_list(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all of a source's filters.
|
|
|
|
|
|
|
|
:param name: Name of the source
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sourceName": name}
|
|
|
|
response = self.base_client.req("GetSourceFilterList", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_source_filter_default_settings(self, kind):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the default settings for a filter kind.
|
|
|
|
|
|
|
|
:param kind: Filter kind to get the default settings for
|
|
|
|
:type kind: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"filterKind": kind}
|
|
|
|
response = self.base_client.req("GetSourceFilterDefaultSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_source_filter(
|
2022-07-25 23:51:30 +01:00
|
|
|
self, source_name, filter_name, filter_kind, filter_settings=None
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the default settings for a filter kind.
|
|
|
|
|
|
|
|
:param source_name: Name of the source to add the filter to
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the new filter to be created
|
|
|
|
:type filter_name: str
|
|
|
|
:param filter_kind: The kind of filter to be created
|
|
|
|
:type filter_kind: str
|
|
|
|
:param filter_settings: Settings object to initialize the filter with
|
|
|
|
:type filter_settings: dict
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": filter_name,
|
|
|
|
"filterKind": filter_kind,
|
|
|
|
"filterSettings": filter_settings,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("CreateSourceFilter", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def remove_source_filter(self, source_name, filter_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the default settings for a filter kind.
|
|
|
|
|
|
|
|
:param source_name: Name of the source the filter is on
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the filter to remove
|
|
|
|
:type filter_name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": filter_name,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("RemoveSourceFilter", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_source_filter_name(self, source_name, old_filter_name, new_filter_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the name of a source filter (rename).
|
|
|
|
|
|
|
|
:param source_name: Name of the source the filter is on
|
|
|
|
:type source_name: str
|
|
|
|
:param old_filter_name: Current name of the filter
|
|
|
|
:type old_filter_name: str
|
|
|
|
:param new_filter_name: New name for the filter
|
|
|
|
:type new_filter_name: str
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": old_filter_name,
|
|
|
|
"newFilterName": new_filter_name,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSourceFilterName", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_source_filter(self, source_name, filter_name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the info for a specific source filter.
|
|
|
|
|
|
|
|
:param source_name: Name of the source
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the filter
|
|
|
|
:type filter_name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sourceName": source_name, "filterName": filter_name}
|
|
|
|
response = self.base_client.req("GetSourceFilter", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_source_filter_index(self, source_name, filter_name, filter_index):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Sets the index position of a filter on a source.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param source_name: Name of the source the filter is on
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the filter
|
|
|
|
:type filter_name: str
|
|
|
|
:param filterIndex: New index position of the filter (>= 0)
|
|
|
|
:type filterIndex: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": filter_name,
|
|
|
|
"filterIndex": filter_index,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSourceFilterIndex", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_source_filter_settings(
|
|
|
|
self, source_name, filter_name, settings, overlay=None
|
|
|
|
):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Sets the settings of a source filter.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param source_name: Name of the source the filter is on
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the filter to set the settings of
|
|
|
|
:type filter_name: str
|
|
|
|
:param settings: Dictionary of settings to apply
|
|
|
|
:type settings: dict
|
|
|
|
:param overlay: True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings.
|
|
|
|
:type overlay: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": filter_name,
|
|
|
|
"filterSettings": settings,
|
|
|
|
"overlay": overlay,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSourceFilterSettings", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_source_filter_enabled(self, source_name, filter_name, enabled):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
Sets the enable state of a source filter.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
:param source_name: Name of the source the filter is on
|
|
|
|
:type source_name: str
|
|
|
|
:param filter_name: Name of the filter
|
|
|
|
:type filter_name: str
|
|
|
|
:param enabled: New enable state of the filter
|
|
|
|
:type enabled: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sourceName": source_name,
|
|
|
|
"filterName": filter_name,
|
|
|
|
"filterEnabled": enabled,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSourceFilterEnabled", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_list(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all scene items in a scene.
|
|
|
|
|
|
|
|
:param name: Name of the scene to get the items of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("GetSceneItemList", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_group_item_list(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of all scene items in a scene.
|
|
|
|
|
|
|
|
:param name: Name of the group to get the items of
|
|
|
|
:type name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"sceneName": name}
|
|
|
|
response = self.base_client.req("GetGroupItemList", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_id(self, scene_name, source_name, offset=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Searches a scene for a source, and returns its id.
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene or group to search in
|
|
|
|
:type scene_name: str
|
|
|
|
:param source_name: Name of the source to find
|
|
|
|
:type source_name: str
|
|
|
|
:param offset: Number of matches to skip during search. >= 0 means first forward. -1 means last (top) item (>= -1)
|
|
|
|
:type offset: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sourceName": source_name,
|
|
|
|
"searchOffset": offset,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemId", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def create_scene_item(self, scene_name, source_name, enabled=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Creates a new scene item using a source.
|
|
|
|
Scenes only
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene to create the new item in
|
|
|
|
:type scene_name: str
|
|
|
|
:param source_name: Name of the source to add to the scene
|
|
|
|
:type source_name: str
|
|
|
|
:param enabled: Enable state to apply to the scene item on creation
|
|
|
|
:type enabled: bool
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sourceName": source_name,
|
|
|
|
"sceneItemEnabled": enabled,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("CreateSceneItem", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def remove_scene_item(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Removes a scene item from a scene.
|
|
|
|
Scenes only
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item
|
|
|
|
:type item_id: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("RemoveSceneItem", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def duplicate_scene_item(self, scene_name, item_id, dest_scene_name=None):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Duplicates a scene item, copying all transform and crop info.
|
|
|
|
Scenes only
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param dest_scene_name: Name of the scene to create the duplicated item in
|
|
|
|
:type dest_scene_name: str
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"destinationSceneName": dest_scene_name,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("DuplicateSceneItem", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_transform(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the transform and crop info of a scene item.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemTransform", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_item_transform(self, scene_name, item_id, transform):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the transform and crop info of a scene item.
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param transform: Dictionary containing scene item transform info to update
|
|
|
|
:type transform: dict
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"sceneItemTransform": transform,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSceneItemTransform", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_enabled(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the enable state of a scene item.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemEnabled", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_item_enabled(self, scene_name, item_id, enabled):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the enable state of a scene item.
|
|
|
|
Scenes and Groups'
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param enabled: New enable state of the scene item
|
|
|
|
:type enabled: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"sceneItemEnabled": enabled,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSceneItemEnabled", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_locked(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the lock state of a scene item.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemLocked", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_item_locked(self, scene_name, item_id, locked):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the lock state of a scene item.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param locked: New lock state of the scene item
|
|
|
|
:type locked: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"sceneItemLocked": locked,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSceneItemLocked", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_index(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the index position of a scene item in a scene.
|
|
|
|
An index of 0 is at the bottom of the source list in the UI.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemIndex", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_item_index(self, scene_name, item_id, item_index):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the index position of a scene item in a scene.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param item_index: New index position of the scene item (>= 0)
|
|
|
|
:type item_index: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"sceneItemLocked": item_index,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSceneItemIndex", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_scene_item_blend_mode(self, scene_name, item_id):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the blend mode of a scene item.
|
|
|
|
Blend modes:
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
OBS_BLEND_NORMAL
|
|
|
|
OBS_BLEND_ADDITIVE
|
|
|
|
OBS_BLEND_SUBTRACT
|
|
|
|
OBS_BLEND_SCREEN
|
|
|
|
OBS_BLEND_MULTIPLY
|
|
|
|
OBS_BLEND_LIGHTEN
|
|
|
|
OBS_BLEND_DARKEN
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetSceneItemBlendMode", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_scene_item_blend_mode(self, scene_name, item_id, blend):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the blend mode of a scene item.
|
|
|
|
Scenes and Groups
|
|
|
|
|
|
|
|
:param scene_name: Name of the scene the item is in
|
|
|
|
:type scene_name: str
|
|
|
|
:param item_id: Numeric ID of the scene item (>= 0)
|
|
|
|
:type item_id: int
|
|
|
|
:param blend: New blend mode
|
|
|
|
:type blend: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
payload = {
|
2022-07-25 23:51:30 +01:00
|
|
|
"sceneName": scene_name,
|
|
|
|
"sceneItemId": item_id,
|
|
|
|
"sceneItemBlendMode": blend,
|
2022-06-05 12:40:55 +01:00
|
|
|
}
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SetSceneItemBlendMode", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_virtual_cam_status(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the status of the virtualcam output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetVirtualCamStatus")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_virtual_cam(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles the state of the virtualcam output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ToggleVirtualCam")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def start_virtual_cam(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Starts the virtualcam output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StartVirtualCam")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def stop_virtual_cam(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Stops the virtualcam output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StopVirtualCam")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_replay_buffer_status(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the status of the replay buffer output.
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetReplayBufferStatus")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_replay_buffer(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles the state of the replay buffer output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ToggleReplayBuffer")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def start_replay_buffer(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Starts the replay buffer output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StartReplayBuffer")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def stop_replay_buffer(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Stops the replay buffer output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StopReplayBuffer")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def save_replay_buffer(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Saves the contents of the replay buffer output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SaveReplayBuffer")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_last_replay_buffer_replay(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the filename of the last replay buffer save file.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetLastReplayBufferReplay")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_stream_status(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the status of the stream output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetStreamStatus")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_stream(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles the status of the stream output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ToggleStream")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def start_stream(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Starts the stream output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StartStream")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def stop_stream(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Stops the stream output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StopStream")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def send_stream_caption(self, caption):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sends CEA-608 caption text over the stream output.
|
|
|
|
|
|
|
|
:param caption: Caption text
|
|
|
|
:type caption: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("SendStreamCaption")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_record_status(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the status of the record output.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetRecordStatus")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_record(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles the status of the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ToggleRecord")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def start_record(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Starts the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StartRecord")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def stop_record(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Stops the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("StopRecord")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def toggle_record_pause(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Toggles pause on the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ToggleRecordPause")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def pause_record(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Pauses the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("PauseRecord")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def resume_record(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Resumes the record output.
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("ResumeRecord")
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_media_input_status(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets the status of a media input.
|
|
|
|
|
|
|
|
Media States:
|
|
|
|
OBS_MEDIA_STATE_NONE
|
|
|
|
OBS_MEDIA_STATE_PLAYING
|
|
|
|
OBS_MEDIA_STATE_OPENING
|
|
|
|
OBS_MEDIA_STATE_BUFFERING
|
|
|
|
OBS_MEDIA_STATE_PAUSED
|
|
|
|
OBS_MEDIA_STATE_STOPPED
|
|
|
|
OBS_MEDIA_STATE_ENDED
|
|
|
|
OBS_MEDIA_STATE_ERROR
|
|
|
|
|
|
|
|
:param name: Name of the media input
|
|
|
|
:type name: str
|
|
|
|
|
2022-06-05 15:06:50 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("GetMediaInputStatus", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_media_input_cursor(self, name, cursor):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Sets the cursor position of a media input.
|
|
|
|
This request does not perform bounds checking of the cursor position.
|
|
|
|
|
|
|
|
:param name: Name of the media input
|
|
|
|
:type name: str
|
|
|
|
:param cursor: New cursor position to set (>= 0)
|
|
|
|
:type cursor: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "mediaCursor": cursor}
|
|
|
|
response = self.base_client.req("SetMediaInputCursor", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def offset_media_input_cursor(self, name, offset):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Offsets the current cursor position of a media input by the specified value.
|
|
|
|
This request does not perform bounds checking of the cursor position.
|
|
|
|
|
|
|
|
:param name: Name of the media input
|
|
|
|
:type name: str
|
|
|
|
:param offset: Value to offset the current cursor position by
|
|
|
|
:type offset: int
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "mediaCursorOffset": offset}
|
|
|
|
response = self.base_client.req("OffsetMediaInputCursor", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def trigger_media_input_action(self, name, action):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Triggers an action on a media input.
|
|
|
|
|
|
|
|
:param name: Name of the media input
|
|
|
|
:type name: str
|
|
|
|
:param action: Identifier of the ObsMediaInputAction enum
|
|
|
|
:type action: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name, "mediaAction": action}
|
|
|
|
response = self.base_client.req("TriggerMediaInputAction", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_studio_mode_enabled(self):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets whether studio is enabled.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-26 21:48:52 +01:00
|
|
|
return self.getter("GetStudioModeEnabled")
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def set_studio_mode_enabled(self, enabled):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Enables or disables studio mode
|
|
|
|
|
|
|
|
:param enabled: True == Enabled, False == Disabled
|
|
|
|
:type enabled: bool
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"studioModeEnabled": enabled}
|
|
|
|
response = self.base_client.req("SetStudioModeEnabled", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def open_input_properties_dialog(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Opens the properties dialog of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to open the dialog of
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("OpenInputPropertiesDialog", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def open_input_filters_dialog(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Opens the filters dialog of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to open the dialog of
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("OpenInputFiltersDialog", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def open_input_interact_dialog(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Opens the filters dialog of an input.
|
|
|
|
|
|
|
|
:param name: Name of the input to open the dialog of
|
|
|
|
:type name: str
|
2022-06-05 15:06:50 +01:00
|
|
|
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
payload = {"inputName": name}
|
|
|
|
response = self.base_client.req("OpenInputInteractDialog", payload)
|
2022-06-05 12:40:55 +01:00
|
|
|
return response
|
|
|
|
|
2022-07-26 21:48:52 +01:00
|
|
|
def get_monitor_list(self, name):
|
2022-06-05 12:40:55 +01:00
|
|
|
"""
|
|
|
|
Gets a list of connected monitors and information about them.
|
2022-07-25 23:51:30 +01:00
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
|
|
|
|
"""
|
2022-07-25 23:51:30 +01:00
|
|
|
response = self.base_client.req("GetMonitorList")
|
|
|
|
return response
|