-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup-apps.py
35 lines (30 loc) · 1.17 KB
/
startup-apps.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
import obspython, platform, json, subprocess, os
os=platform.system()
if os == "Windows":
prepend='start "" '
elif os == "Darwin":
prepend='open '
elif os == "Linux":
prepend='xdg-open '
else:
prepend=''
def script_description():
return "run command(s) on obs startup"
def script_defaults(settings):
defaults=obspython.obs_data_create_from_json(json.dumps({'commands':[]}))
obspython.obs_data_apply(defaults,settings)
obspython.obs_data_apply(settings,defaults)
def script_load(settings):
settings=json.loads(obspython.obs_data_get_json(settings))
commands=settings['commands']
for command in commands:
if(os != "Windows" and os.access(command['value'], os.X_OK)):
print(command['value'])
subprocess.Popen([command['value']])
else:
print(prepend+command['value'])
subprocess.Popen(prepend+'"'+command['value']+'"',shell=True)
def script_properties():
properties=obspython.obs_properties_create()
editableList=obspython.obs_properties_add_editable_list(properties,'commands','startup app list',obspython.OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS,None,None)
return properties