From 83577e2d61c256809e7bf6490041f4096ab20fa7 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 9 Oct 2023 22:06:18 +0100 Subject: [PATCH 1/3] adds projector methods with a deprecation warning patch bump closes #35 --- obsws_python/reqs.py | 64 +++++++++++++++++++++++++++++++++++++++++ obsws_python/version.py | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index 4321d29..8963b2d 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -1,4 +1,5 @@ import logging +from warnings import warn from .baseclient import ObsClient from .error import OBSSDKError, OBSSDKRequestError @@ -1938,3 +1939,66 @@ class ReqClient: """ return self.send("GetMonitorList") + + def open_video_mix_projector( + self, video_mix_type, monitor_index=-1, projector_geometry=None + ): + """ + Opens a projector for a specific output video mix. + + The available mix types are: + OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW + OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM + OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW + + :param video_mix_type: Type of mix to open. + :type video_mix_type: str + :param monitor_index: Monitor index, use GetMonitorList to obtain index + :type monitor_index: int + :param projector_geometry: + Size/Position data for a windowed projector, + in Qt Base64 encoded format. Mutually exclusive with monitorIndex + :type projector_geometry: str + + """ + warn( + "open_video_mix_projector request serves to provide feature parity with 4.x. " + "It is very likely to be changed/deprecated in a future release.", + DeprecationWarning, + stacklevel=2, + ) + payload = { + "videoMixType": video_mix_type, + "monitorIndex": monitor_index, + "projectorGeometry": projector_geometry, + } + self.send("OpenVideoMixProjector", payload) + + def open_source_projector( + self, source_name, monitor_index=-1, projector_geometry=None + ): + """ + Opens a projector for a source. + + :param source_name: Name of the source to open a projector for + :type source_name: str + :param monitor_index: Monitor index, use GetMonitorList to obtain index + :type monitor_index: int + :param projector_geometry: + Size/Position data for a windowed projector, + in Qt Base64 encoded format. Mutually exclusive with monitorIndex + :type projector_geometry: str + + """ + warn( + "open_source_projector request serves to provide feature parity with 4.x. " + "It is very likely to be changed/deprecated in a future release.", + DeprecationWarning, + stacklevel=2, + ) + payload = { + "sourceName": source_name, + "monitorIndex": monitor_index, + "projectorGeometry": projector_geometry, + } + self.send("OpenSourceProjector", payload) diff --git a/obsws_python/version.py b/obsws_python/version.py index 38ec8ed..cead7e8 100644 --- a/obsws_python/version.py +++ b/obsws_python/version.py @@ -1 +1 @@ -version = "1.6.0" +version = "1.6.1" From ba5da8dfef256ae8f27d55cbe9acdc4f8d95a9ba Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 9 Oct 2023 22:29:18 +0100 Subject: [PATCH 2/3] upd obsbasic hotkey list in tests --- tests/test_request.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_request.py b/tests/test_request.py index 5996056..cd45c70 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -15,9 +15,9 @@ class TestRequests: resp = req_cl.get_hot_key_list() obsbasic_hotkey_list = [ "OBSBasic.SelectScene", - "OBSBasic.SelectScene", - "OBSBasic.SelectScene", - "OBSBasic.SelectScene", + "OBSBasic.QuickTransition.1", + "OBSBasic.QuickTransition.2", + "OBSBasic.QuickTransition.3", "OBSBasic.StartStreaming", "OBSBasic.StopStreaming", "OBSBasic.ForceStopStreaming", @@ -25,15 +25,17 @@ class TestRequests: "OBSBasic.StopRecording", "OBSBasic.PauseRecording", "OBSBasic.UnpauseRecording", + "OBSBasic.SplitFile", "OBSBasic.StartReplayBuffer", "OBSBasic.StopReplayBuffer", "OBSBasic.StartVirtualCam", "OBSBasic.StopVirtualCam", "OBSBasic.EnablePreview", "OBSBasic.DisablePreview", + "OBSBasic.EnablePreviewProgram", + "OBSBasic.DisablePreviewProgram", "OBSBasic.ShowContextBar", "OBSBasic.HideContextBar", - "OBSBasic.TogglePreviewProgram", "OBSBasic.Transition", "OBSBasic.ResetStats", "OBSBasic.Screenshot", From c4cf817042b2f0fdb7d6aa7c87744e85f2d783d0 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 9 Oct 2023 22:34:05 +0100 Subject: [PATCH 3/3] split at full stop --- obsws_python/reqs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index 8963b2d..5938af9 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -1956,8 +1956,8 @@ class ReqClient: :param monitor_index: Monitor index, use GetMonitorList to obtain index :type monitor_index: int :param projector_geometry: - Size/Position data for a windowed projector, - in Qt Base64 encoded format. Mutually exclusive with monitorIndex + Size/Position data for a windowed projector, in Qt Base64 encoded format. + Mutually exclusive with monitorIndex :type projector_geometry: str """ @@ -1985,8 +1985,8 @@ class ReqClient: :param monitor_index: Monitor index, use GetMonitorList to obtain index :type monitor_index: int :param projector_geometry: - Size/Position data for a windowed projector, - in Qt Base64 encoded format. Mutually exclusive with monitorIndex + Size/Position data for a windowed projector, in Qt Base64 encoded format. + Mutually exclusive with monitorIndex :type projector_geometry: str """