-
Notifications
You must be signed in to change notification settings - Fork 0
/
iTrace-Recorder.py
68 lines (45 loc) · 1.47 KB
/
iTrace-Recorder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import obspython as obs
import asyncio
import socket
import threading
import time
HOST = "127.0.0.1"
PORT = 8008
TRACKING = False
#profiles = obs.obs_frontend_get_current_profile_path()
#print(profiles)
#print(obs.obs_output_t)
def connectToCore():
global TRACKING
print("Connecting to core...")
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST,PORT))
#output = obs.obs_output_create("itrace","iTrace Record",
while TRACKING:
data = s.recv(1024)
if not data: break
if data == b"session_end\n":
print("Got end")
obs.obs_frontend_recording_stop()
break
elif data.startswith(b"session_start"):
print("Got start!",obs.obs_frontend_get_current_record_output_path())
obs.obs_frontend_recording_start()
#print(data)
print("Loop stopped, disconnected!")
TRACKING = False
def script_load(settings):
print("Loading script")
def connectButton(*args):
global TRACKING
if TRACKING:
print("Already connected to Core")
return
TRACKING = True
x = threading.Thread(target=connectToCore)
x.start()
print("Pressed!")
def script_properties():
properties = obs.obs_properties_create()
con_button = obs.obs_properties_add_button(properties, "connect_button","Connect to Core",connectButton)
return properties