remove python leftovers
This commit is contained in:
parent
3818e5b6c3
commit
9b32d25c82
2 changed files with 0 additions and 75 deletions
|
@ -1,3 +0,0 @@
|
||||||
obs-websocket-py==0.5.3
|
|
||||||
six==1.16.0
|
|
||||||
websocket-client==1.2.1
|
|
|
@ -1,72 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from sys import argv
|
|
||||||
import logging
|
|
||||||
import time
|
|
||||||
|
|
||||||
from obswebsocket import events, obsws
|
|
||||||
|
|
||||||
logging.basicConfig(
|
|
||||||
format="%(asctime)s %(name)s [%(levelname)s] %(message)s",
|
|
||||||
level=logging.INFO,
|
|
||||||
)
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
host = "localhost"
|
|
||||||
port = 4444
|
|
||||||
password = "12345"
|
|
||||||
|
|
||||||
my_source_name = argv[1]
|
|
||||||
my_source_is_program = False
|
|
||||||
my_source_is_preview = False
|
|
||||||
|
|
||||||
|
|
||||||
def on_event(message):
|
|
||||||
global my_source_is_program, my_source_is_preview
|
|
||||||
|
|
||||||
my_source_in_current_event = False
|
|
||||||
|
|
||||||
if isinstance(message, events.SwitchScenes):
|
|
||||||
visibility = "PROGRAM"
|
|
||||||
elif isinstance(message, events.PreviewSceneChanged):
|
|
||||||
visibility = "PREVIEW"
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
for source in message.datain["sources"]:
|
|
||||||
log.debug(f'visibility of scene {message.datain["scene-name"]} changed, {source["name"]} is now {visibility}')
|
|
||||||
if source["name"] == my_source_name:
|
|
||||||
my_source_in_current_event = True
|
|
||||||
|
|
||||||
if my_source_in_current_event:
|
|
||||||
if visibility == "PROGRAM":
|
|
||||||
my_source_is_program = True
|
|
||||||
else:
|
|
||||||
my_source_is_preview = True
|
|
||||||
else:
|
|
||||||
if visibility == "PROGRAM":
|
|
||||||
my_source_is_program = False
|
|
||||||
else:
|
|
||||||
my_source_is_preview = False
|
|
||||||
|
|
||||||
if my_source_is_program:
|
|
||||||
log.info(f"{my_source_name} is PROGRAM (and maybe preview)")
|
|
||||||
elif my_source_is_preview:
|
|
||||||
log.info(f"{my_source_name} is PREVIEW only")
|
|
||||||
else:
|
|
||||||
log.info(f"{my_source_name} is not visible")
|
|
||||||
|
|
||||||
|
|
||||||
ws = obsws(host, port, password)
|
|
||||||
ws.register(on_event)
|
|
||||||
ws.connect()
|
|
||||||
|
|
||||||
try:
|
|
||||||
log.info("Waiting ...")
|
|
||||||
time.sleep(3600)
|
|
||||||
log.warn("Timeout!")
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
pass
|
|
||||||
|
|
||||||
ws.disconnect()
|
|
Loading…
Reference in a new issue