mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-06-07 20:20:32 +01:00
update the pytest scene name
create and destroy source/scene filters at start/end of tests ensure we stop replay buffer if its running at end of tests
This commit is contained in:
parent
fdbb3ebe22
commit
85d2cce4c6
@ -46,9 +46,9 @@ def pytest_sessionstart(session):
|
|||||||
|
|
||||||
session.obsws.set_current_scene_collection('test-collection')
|
session.obsws.set_current_scene_collection('test-collection')
|
||||||
|
|
||||||
session.obsws.create_scene('pytest')
|
session.obsws.create_scene('pytest_scene')
|
||||||
session.obsws.create_input(
|
session.obsws.create_input(
|
||||||
sceneName='pytest',
|
sceneName='pytest_scene',
|
||||||
inputName='pytest_input',
|
inputName='pytest_input',
|
||||||
inputKind='color_source_v3',
|
inputKind='color_source_v3',
|
||||||
inputSettings={
|
inputSettings={
|
||||||
@ -60,7 +60,7 @@ def pytest_sessionstart(session):
|
|||||||
sceneItemEnabled=True,
|
sceneItemEnabled=True,
|
||||||
)
|
)
|
||||||
session.obsws.create_input(
|
session.obsws.create_input(
|
||||||
sceneName='pytest',
|
sceneName='pytest_scene',
|
||||||
inputName='pytest_input_2',
|
inputName='pytest_input_2',
|
||||||
inputKind='color_source_v3',
|
inputKind='color_source_v3',
|
||||||
inputSettings={
|
inputSettings={
|
||||||
@ -71,11 +71,11 @@ def pytest_sessionstart(session):
|
|||||||
},
|
},
|
||||||
sceneItemEnabled=True,
|
sceneItemEnabled=True,
|
||||||
)
|
)
|
||||||
resp = session.obsws.get_scene_item_list('pytest')
|
resp = session.obsws.get_scene_item_list('pytest_scene')
|
||||||
for item in resp.scene_items:
|
for item in resp.scene_items:
|
||||||
if item['sourceName'] == 'pytest_input_2':
|
if item['sourceName'] == 'pytest_input_2':
|
||||||
session.obsws.set_scene_item_transform(
|
session.obsws.set_scene_item_transform(
|
||||||
'pytest',
|
'pytest_scene',
|
||||||
item['sceneItemId'],
|
item['sceneItemId'],
|
||||||
{
|
{
|
||||||
'rotation': 0,
|
'rotation': 0,
|
||||||
@ -83,13 +83,47 @@ def pytest_sessionstart(session):
|
|||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Create a source filter for the Mic/Aux source
|
||||||
|
session.obsws.create_source_filter(
|
||||||
|
source_name='Mic/Aux',
|
||||||
|
filter_name='pytest filter',
|
||||||
|
filter_kind='compressor_filter',
|
||||||
|
filter_settings={
|
||||||
|
'threshold': -20,
|
||||||
|
'ratio': 4,
|
||||||
|
'attack_time': 10,
|
||||||
|
'release_time': 100,
|
||||||
|
'output_gain': -3.6,
|
||||||
|
'sidechain_source': None,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a source filter for the pytest scene
|
||||||
|
session.obsws.create_source_filter(
|
||||||
|
source_name='pytest_scene',
|
||||||
|
filter_name='pytest filter',
|
||||||
|
filter_kind='luma_key_filter_v2',
|
||||||
|
filter_settings={'luma_max': 0.6509},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def pytest_sessionfinish(session, exitstatus):
|
def pytest_sessionfinish(session, exitstatus):
|
||||||
"""Call after the whole test run finishes.
|
"""Call after the whole test run finishes.
|
||||||
|
|
||||||
Return the exit status to the system.
|
Return the exit status to the system.
|
||||||
"""
|
"""
|
||||||
session.obsws.remove_scene('pytest')
|
session.obsws.remove_source_filter(
|
||||||
|
source_name='Mic/Aux',
|
||||||
|
filter_name='pytest filter',
|
||||||
|
)
|
||||||
|
|
||||||
|
session.obsws.remove_source_filter(
|
||||||
|
source_name='pytest_scene',
|
||||||
|
filter_name='pytest filter',
|
||||||
|
)
|
||||||
|
|
||||||
|
session.obsws.remove_scene('pytest_scene')
|
||||||
|
|
||||||
session.obsws.set_current_scene_collection('default')
|
session.obsws.set_current_scene_collection('default')
|
||||||
|
|
||||||
resp = session.obsws.get_stream_status()
|
resp = session.obsws.get_stream_status()
|
||||||
@ -100,6 +134,10 @@ def pytest_sessionfinish(session, exitstatus):
|
|||||||
if resp.output_active:
|
if resp.output_active:
|
||||||
session.obsws.stop_record()
|
session.obsws.stop_record()
|
||||||
|
|
||||||
|
resp = session.obsws.get_replay_buffer_status()
|
||||||
|
if resp.output_active:
|
||||||
|
session.obsws.stop_replay_buffer()
|
||||||
|
|
||||||
# Close the OBS WebSocket client connection
|
# Close the OBS WebSocket client connection
|
||||||
session.obsws.disconnect()
|
session.obsws.disconnect()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user