Advertisement
romaji

dashboard jank

Mar 3rd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.82 KB | None | 0 0
  1. import obspython as obs
  2.  
  3. source_names = ["","","","","","","",""]
  4. resources = ("KioEO","KioEN","FunkEO","FunkEN","KompEO","KompEN","SakruEO","SakruEN")
  5. sources = [None,None,None,None,None,None,None,None]
  6. visible = True
  7. index=-1
  8.  
  9. global status
  10.  
  11.  
  12. # ------------------------------------------------------------
  13.  
  14.  
  15. def kio_pressed(props, prop):
  16.     """
  17.    Called when the 'Kio' button defined below is pressed
  18.    """
  19.     print("kio Pressed")
  20.     global index
  21.     index=0
  22.     trigger()
  23.  
  24. def funk_pressed(props, prop):
  25.     """
  26.    Called when the 'funk' button defined below is pressed
  27.    """
  28.     print("funk Pressed")
  29.     global index
  30.     index=1
  31.     trigger()
  32.  
  33. def komp_pressed(props, prop):
  34.     """
  35.    Called when the 'komp' button defined below is pressed
  36.    """
  37.     print("komp Pressed")
  38.     global index
  39.     index=2
  40.     trigger()
  41.  
  42. def sakru_pressed(props, prop):
  43.     """
  44.    Called when the 'sakru' button defined below is pressed
  45.    """
  46.     print("sakru Pressed")
  47.     global index
  48.     index=3
  49.     trigger()
  50.  
  51. def trigger():
  52.     global source_names
  53.     global index
  54.     global sources
  55.     sources[2*index] = obs.obs_get_source_by_name(source_names[2*index])
  56.     sources[2*index+1] = obs.obs_get_source_by_name(source_names[2*index+1])
  57.    
  58.     if sources[2*index] is not None and sources[2*index+1] is not None:
  59.         obs.obs_source_set_enabled(sources[2*index], True)
  60.         global status
  61.         status = 0
  62.         obs.timer_add(timed, 600)
  63. def timed():
  64.     global status
  65.     global index
  66.     global sources
  67.     if status == 2:
  68.         obs.obs_source_set_enabled(sources[2*index], False)
  69.        
  70.     elif status ==3:
  71.         obs.obs_source_set_enabled(sources[2*index+1],True)
  72.  
  73.     elif status == 5:
  74.         obs.obs_source_set_enabled(sources[2*index+1],False)
  75.         status=-1
  76.         index=-1
  77.         obs.timer_remove(timed)
  78.     status +=1
  79.     print(status)
  80. # ------------------------------------------------------------
  81.  
  82.  
  83. def script_properties():
  84.     """
  85.    Called to define user properties associated with the script. These
  86.    properties are used to define how to show settings properties to a user.
  87.    """
  88.     props = obs.obs_properties_create()
  89.     ps=[]
  90.     ps.append(obs.obs_properties_add_list(props, "KioEO", "Kio",
  91.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  92.                                     obs.OBS_COMBO_FORMAT_STRING))
  93.     ps.append(obs.obs_properties_add_list(props, "KioEN", "What",
  94.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  95.                                     obs.OBS_COMBO_FORMAT_STRING))
  96.     ps.append(obs.obs_properties_add_list(props, "FunkEO", "Funk",
  97.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  98.                                     obs.OBS_COMBO_FORMAT_STRING))
  99.     ps.append(obs.obs_properties_add_list(props, "FunkEN", "Work",
  100.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  101.                                     obs.OBS_COMBO_FORMAT_STRING))
  102.     ps.append(obs.obs_properties_add_list(props, "KompEO", "Komp",
  103.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  104.                                     obs.OBS_COMBO_FORMAT_STRING))
  105.     ps.append(obs.obs_properties_add_list(props, "KompEN", "Under",
  106.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  107.                                     obs.OBS_COMBO_FORMAT_STRING))
  108.     ps.append(obs.obs_properties_add_list(props, "SakruEO", "Sakru",
  109.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  110.                                     obs.OBS_COMBO_FORMAT_STRING))
  111.     ps.append(obs.obs_properties_add_list(props, "SakruEN", "Swear",
  112.                                     obs.OBS_COMBO_TYPE_EDITABLE,
  113.                                     obs.OBS_COMBO_FORMAT_STRING))
  114.     sources = obs.obs_enum_sources()
  115.     if sources is not None:
  116.         for source in sources:
  117.             source_id = obs.obs_source_get_id(source)
  118.             if source_id == "text_gdiplus" or source_id == "text_ft2_source":
  119.                 name = obs.obs_source_get_name(source)
  120.                 for p in ps:
  121.                     obs.obs_property_list_add_string(p, name, name)
  122.  
  123.         obs.source_list_release(sources)
  124.  
  125.     obs.obs_properties_add_button(props, "button1", "kio", kio_pressed)
  126.     obs.obs_properties_add_button(props, "button2", "funk", funk_pressed)
  127.     obs.obs_properties_add_button(props, "button3", "komp", komp_pressed)
  128.     obs.obs_properties_add_button(props, "button4", "sakru", sakru_pressed)
  129.     index=-1
  130.     return props
  131.  
  132. def script_update(settings):
  133.     """
  134.    Called when the script’s settings (if any) have been changed by the user.
  135.    """
  136.     global source_names
  137.     global resources
  138.     for i in range(len(source_names)):
  139.         source_names[i]=obs.obs_data_get_string(settings, resources[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement