Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import obspython as obs
- source_names = ["","","","","","","",""]
- resources = ("KioEO","KioEN","FunkEO","FunkEN","KompEO","KompEN","SakruEO","SakruEN")
- sources = [None,None,None,None,None,None,None,None]
- visible = True
- index=-1
- global status
- # ------------------------------------------------------------
- def kio_pressed(props, prop):
- """
- Called when the 'Kio' button defined below is pressed
- """
- print("kio Pressed")
- global index
- index=0
- trigger()
- def funk_pressed(props, prop):
- """
- Called when the 'funk' button defined below is pressed
- """
- print("funk Pressed")
- global index
- index=1
- trigger()
- def komp_pressed(props, prop):
- """
- Called when the 'komp' button defined below is pressed
- """
- print("komp Pressed")
- global index
- index=2
- trigger()
- def sakru_pressed(props, prop):
- """
- Called when the 'sakru' button defined below is pressed
- """
- print("sakru Pressed")
- global index
- index=3
- trigger()
- def trigger():
- global source_names
- global index
- global sources
- sources[2*index] = obs.obs_get_source_by_name(source_names[2*index])
- sources[2*index+1] = obs.obs_get_source_by_name(source_names[2*index+1])
- if sources[2*index] is not None and sources[2*index+1] is not None:
- obs.obs_source_set_enabled(sources[2*index], True)
- global status
- status = 0
- obs.timer_add(timed, 600)
- def timed():
- global status
- global index
- global sources
- if status == 2:
- obs.obs_source_set_enabled(sources[2*index], False)
- elif status ==3:
- obs.obs_source_set_enabled(sources[2*index+1],True)
- elif status == 5:
- obs.obs_source_set_enabled(sources[2*index+1],False)
- status=-1
- index=-1
- obs.timer_remove(timed)
- status +=1
- print(status)
- # ------------------------------------------------------------
- def script_properties():
- """
- Called to define user properties associated with the script. These
- properties are used to define how to show settings properties to a user.
- """
- props = obs.obs_properties_create()
- ps=[]
- ps.append(obs.obs_properties_add_list(props, "KioEO", "Kio",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "KioEN", "What",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "FunkEO", "Funk",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "FunkEN", "Work",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "KompEO", "Komp",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "KompEN", "Under",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "SakruEO", "Sakru",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- ps.append(obs.obs_properties_add_list(props, "SakruEN", "Swear",
- obs.OBS_COMBO_TYPE_EDITABLE,
- obs.OBS_COMBO_FORMAT_STRING))
- sources = obs.obs_enum_sources()
- if sources is not None:
- for source in sources:
- source_id = obs.obs_source_get_id(source)
- if source_id == "text_gdiplus" or source_id == "text_ft2_source":
- name = obs.obs_source_get_name(source)
- for p in ps:
- obs.obs_property_list_add_string(p, name, name)
- obs.source_list_release(sources)
- obs.obs_properties_add_button(props, "button1", "kio", kio_pressed)
- obs.obs_properties_add_button(props, "button2", "funk", funk_pressed)
- obs.obs_properties_add_button(props, "button3", "komp", komp_pressed)
- obs.obs_properties_add_button(props, "button4", "sakru", sakru_pressed)
- index=-1
- return props
- def script_update(settings):
- """
- Called when the script’s settings (if any) have been changed by the user.
- """
- global source_names
- global resources
- for i in range(len(source_names)):
- source_names[i]=obs.obs_data_get_string(settings, resources[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement