def script_update(settings):
    global INTERVAL_LIST

    if obs.obs_data_get_bool(settings, "enabled"):
        obs.obs_hotkey_register_frontend("Space",
                                         "enable_space_to_start_script",
                                         space_callback)

    elif not obs.obs_data_get_bool(settings, "enabled"):
        obs.obs_hotkey_unregister(space_callback)

    path = obs.obs_data_get_string("interval_path")

    if path != "" and path.endswith(".txt"):
        with open(path, "r") as f:
            line = f.readline()
            while line != "":
                raw = line.split(":")
                if (len(raw) == 3):
                    hour = int(raw[0])
                    minute = int(raw[1])
                    second = int(raw[2])
                    milisec = (hour * 3600 + minute * 60 + second) * 1000
                    INTERVAL_LIST.append(milisec)
                line = f.readline()
def script_load(settings):
    global zoom_id_tog
    zoom_id_tog = obs.obs_hotkey_register_frontend(ZOOM_NAME_TOG,
                                                   ZOOM_DESC_TOG, toggle_zoom)
    hotkey_save_array = obs.obs_data_get_array(settings, ZOOM_NAME_TOG)
    obs.obs_hotkey_load(zoom_id_tog, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)

    global follow_id_tog
    follow_id_tog = obs.obs_hotkey_register_frontend(FOLLOW_NAME_TOG,
                                                     FOLLOW_DESC_TOG,
                                                     toggle_follow)
    hotkey_save_array = obs.obs_data_get_array(settings, FOLLOW_NAME_TOG)
    obs.obs_hotkey_load(follow_id_tog, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)
예제 #3
0
def script_load(settings):
    """
    This is run automatically when the script is loaded. It sets stuff
    up.
    """
    createStateMachine()
    orlyStateMachine.updateSettings(settings)

    # Register hotkeys
    for i in range(5):
        obs.obs_hotkey_register_frontend(
            'orly_counter_inc_' + str(i + 1),
            'ORLY +' + str(i + 1),
            lambda pressed, q=i: handleORLY(pressed, q + 1))
    obs.obs_hotkey_register_frontend('orly_counter_negate', 'Negate next ORLY',
                                     handleNegateORLY)
예제 #4
0
def script_load(settings):
    global hotkey_id_tog
    global hotkey_id_freeze

    hotkey_id_tog = obs.obs_hotkey_register_frontend(HOTKEY_NAME_TOG,
                                                     HOTKEY_DESC_TOG,
                                                     toggle_zoom_follow)
    hotkey_save_array = obs.obs_data_get_array(settings, HOTKEY_NAME_TOG)
    obs.obs_hotkey_load(hotkey_id_tog, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)

    hotkey_id_freeze = obs.obs_hotkey_register_frontend(
        HOTKEY_NAME_FREEZE, HOTKEY_DESC_FREEZE, toggle_zoom_freeze)
    hotkey_save_array = obs.obs_data_get_array(settings, HOTKEY_NAME_FREEZE)
    obs.obs_hotkey_load(hotkey_id_freeze, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)
예제 #5
0
def loadConfig(jsonData):
    for collection in jsonData:
        if collection[
                'sceneCollection'] == obs.obs_frontend_get_current_scene_collection(
                ):
            if collection['sceneName'] == obs.obs_source_get_name(
                    obs.obs_frontend_get_current_scene()):
                scriptSettings['configs'].append(collection)
                for tweener in collection['tweeners']:
                    tweenerFunction = createTweenerFunction(
                        tweener['tweenName'])
                    scriptSettings['tweenerFunctions'].append(tweenerFunction)
                    obs.obs_hotkey_register_frontend(
                        tweener['tweenName'],
                        'Tweener - %s' % (tweener['tweenName']),
                        tweenerFunction)
예제 #6
0
def script_load(settings):
	global hotkey
	hotkey = obs.obs_hotkey_register_frontend("SlideDisplay.hotkey.show", "Show Slide-Display (hold)", hotkey_callback)
	hotkey_save_array = obs.obs_data_get_array(settings, "SlideDisplay.hotkey.show")
	obs.obs_hotkey_load(hotkey, hotkey_save_array)
	obs.obs_data_array_release(hotkey_save_array)

	obs.obs_frontend_add_event_callback(on_event)
예제 #7
0
def script_load(settings):
    obsSettings = settings
    configPath = obs.obs_data_get_string(settings, 'configPath')
    if configPath:
        config.read(configPath)
        if config.has_section('tweenConfigs'):
            for tweener in config.items('tweenConfigs'):
                tweenerConfig = tweener[1]
                if os.path.isfile(tweenerConfig):
                    with open(tweenerConfig) as jsonData:
                        loadConfig(json.load(jsonData))
    obs.obs_hotkey_register_frontend('printSceneData',
                                     'Tweener - Print current scene setup',
                                     printSceneData)
    obs.obs_hotkey_register_frontend('printBaseData',
                                     'Tweener - Print base JSON file data',
                                     printBaseData)
예제 #8
0
def script_load(settings):
    config.streamList = streamList.streamList()
    #streamMsgDispNext
    config.dispNext_hotkey_id = obs.obs_hotkey_register_frontend(
        "streamMsgDispNext", "Stream Msg Increment", displayNextHotkey)
    hotkey_save_array = obs.obs_data_get_array(settings, "streamMsgDispNext")
    obs.obs_hotkey_load(config.dispNext_hotkey_id, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)
    #streamMsgDispPrev
    config.dispPrev_hotkey_id = obs.obs_hotkey_register_frontend(
        "streamMsgDispPrev", "Stream Msg Decrement", displayPrevHotkey)
    hotkey_save_array = obs.obs_data_get_array(settings, "streamMsgDispPrev")
    obs.obs_hotkey_load(config.dispPrev_hotkey_id, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)

    #loads all the initial configs from obs for the tool
    source_name = obs.obs_data_get_string(settings, "source")
    ircServer = obs.obs_data_get_string(settings, "IRC Server")
    ircChannel = obs.obs_data_get_string(settings, "IRC Channel")
    ircPort = obs.obs_data_get_int(settings, "IRC Port")
    ircNickname = obs.obs_data_get_string(settings, "IRC Nickname")
    ircPassword = obs.obs_data_get_string(settings, "IRC Password")
    config.commandPrefix = obs.obs_data_get_string(settings, "Command Prefix")
    config.commandResponse = obs.obs_data_get_string(settings,
                                                     "Command Response")
    config.irc = {
        "Enabled": True,
        "Servers": {
            ircServer: {
                "Channel": {
                    ircChannel: {
                        "Enabled": True
                    }
                },
                "Enabled": True,
                "Nickname": ircNickname,
                "Password": ircPassword,
                "Port": ircPort
            }
        }
    }
    config.obsSource = source_name

    config.secondaryThread = main()
    config.secondaryThread.start()
def script_load(settings):
    s = S.obs_data_create_from_json(JSON_DATA)

    a = S.obs_data_get_array(s, ID)
    h = S.obs_hotkey_register_frontend(ID, ID, on_obs_key_1)
    S.obs_hotkey_load(h, a)

    S.obs_data_array_release(a)
    S.obs_data_release(s)
예제 #10
0
def script_load(settings):
    #Load hotkeys
    for hotkeyId in hotkeyDict:
        hk = obs.obs_hotkey_register_frontend(
            hotkeyId, hotkeyDict[hotkeyId]["description"],
            hotkeyDict[hotkeyId]["function"])
        hotkeyDict[hotkeyId]["id"] = hk
        save_array = obs.obs_data_get_array(settings, hotkeyId)
        obs.obs_hotkey_load(hk, save_array)
        obs.obs_data_array_release(save_array)
def hook(obs_htk_id, htk_id, callback):
    json_data = '{"%s":[{"key":"%s"}]}' % (htk_id, obs_htk_id)
    s = S.obs_data_create_from_json(json_data)

    a = S.obs_data_get_array(s, htk_id)
    h = S.obs_hotkey_register_frontend(htk_id, obs_htk_id, callback)
    S.obs_hotkey_load(h, a)

    S.obs_data_array_release(a)
    S.obs_data_release(s)
def script_load(settings):
    global HOTKEY_ID

    def callback(pressed):
        if pressed:
            return eg.update_text()

    HOTKEY_ID = S.obs_hotkey_register_frontend("htk_id", "Example hotkey",
                                               callback)
    hotkey_save_array_htk = S.obs_data_get_array(settings, "htk_hotkey")
    S.obs_hotkey_load(HOTKEY_ID, hotkey_save_array_htk)
    S.obs_data_array_release(hotkey_save_array_htk)
예제 #13
0
def script_load(settings):
    def callback_up(pressed):
        if pressed:
            return scripted_text_driver.hotkey_hook()

    hotkey_id_scripted_text = obs.obs_hotkey_register_frontend(
        "Trigger sripted text", "Trigger sripted text", callback_up)
    hotkey_save_array_scripted_text = obs.obs_data_get_array(
        settings, "scripted_text_hotkey")
    obs.obs_hotkey_load(hotkey_id_scripted_text,
                        hotkey_save_array_scripted_text)
    obs.obs_data_array_release(hotkey_save_array_scripted_text)
예제 #14
0
    def register_hotkey(self):
        if len(self.text) > ChatMessage.max_description_length:
            key_description = self.text[:ChatMessage.max_description_length -
                                        3] + "..."
        else:
            key_description = self.text
        key_description = "Chat \'" + key_description + "\'"

        self.callback = lambda pressed: self.key_passthrough(
            pressed)  # Small hack to get around the callback signature reqs.
        self.hotkey_id = obs.obs_hotkey_register_frontend(
            "chat_hotkey", key_description, self.callback)
        obs.obs_hotkey_load(self.hotkey_id, self.hotkey_saved_key)
예제 #15
0
def script_load(settings):
    global HOTKEY_ID

    def callback_up(pressed):
        if pressed:
            return scripted_text_driver.hotkey_hook()

    HOTKEY_ID = obs.obs_hotkey_register_frontend("scripted_text_hotkey",
                                                 "Trigger sripted text",
                                                 callback_up)
    hotkey_save_array = obs.obs_data_get_array(settings,
                                               "scripted_text_hotkey")
    obs.obs_hotkey_load(HOTKEY_ID, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)
예제 #16
0
def script_load(settings):
    global keeptime

    # grab the hotkey info from OBS
    global hotkey_id
    hotkey_id = obs.obs_hotkey_register_frontend(script_path(), "PSTimestamp",
                                                 on_timestamp_hotkey)
    hotkey_save_array = obs.obs_data_get_array(settings, "timestamp_hotkey")
    obs.obs_hotkey_load(hotkey_id, hotkey_save_array)
    obs.obs_data_array_release(hotkey_save_array)

    # register events callback
    obs.obs_frontend_add_event_callback(on_event)
    keeptime = False
예제 #17
0
def _register_hot_keys(settings):
	global scenes

	scenes = obs.obs_frontend_get_scenes()
	for i in range(len(scenes)):
		scene = scenes[i]
		scene_id = obs.obs_source_get_name(scene)
		callback = _handle_key(scene, scene_id)
		name = 'toggle.' + scene_id
		hot_key_id = obs.obs_hotkey_register_frontend(name, "Toggle '" + scene_id + "'", callback)
		save_array = obs.obs_data_get_array(settings, name)
		obs.obs_hotkey_load(hot_key_id, save_array)
		obs.obs_data_array_release(save_array)
		hot_keys.append({'callback': callback, 'scene_id': hot_key_id, 'name': name})
예제 #18
0
def script_load(settings):
    global HOTKEY_ID_COUNT_UP
    global HOTKEY_ID_RESET

    def callback_up(pressed):
        if pressed:
            return hotkeys_counter.hotkey_up()

    def callback_reset(pressed):
        if pressed:
            return hotkeys_counter.hotkey_reset()

    HOTKEY_ID_COUNT_UP = obs.obs_hotkey_register_frontend(
        "counter up !", "Count up ", callback_up)
    HOTKEY_ID_RESET = obs.obs_hotkey_register_frontend("reset !", "Reset ",
                                                       callback_reset)
    hotkey_save_array_count_up = obs.obs_data_get_array(
        settings, "count_up_hotkey")
    hotkey_save_array_reset = obs.obs_data_get_array(settings, "reset_hotkey")
    obs.obs_hotkey_load(HOTKEY_ID_COUNT_UP, hotkey_save_array_count_up)
    obs.obs_hotkey_load(HOTKEY_ID_RESET, hotkey_save_array_reset)
    obs.obs_data_array_release(hotkey_save_array_count_up)
    obs.obs_data_array_release(hotkey_save_array_reset)
    def script_load(settings_):
        global settings

        settings = settings_

        reset_match_info()

        # run child reaper every second
        obs.timer_add(check_children, 1000)

        # get saved hotkey data
        hotkey_start = obs.obs_data_get_array(settings, 'hotkey_start')
        hotkey_stop = obs.obs_data_get_array(settings, 'hotkey_stop')
        hotkey_cancel = obs.obs_data_get_array(settings, 'hotkey_cancel')

        # register hotkeys
        hotkeys['start'] = obs.obs_hotkey_register_frontend(
            'ftc-match-uploader_start', '(FTC) Start recording a match',
            start_recording)
        hotkeys['stop'] = obs.obs_hotkey_register_frontend(
            'ftc-match-uploader_stop',
            '(FTC) Stop recording a match and upload to YouTube',
            stop_recording_and_upload)
        hotkeys['cancel'] = obs.obs_hotkey_register_frontend(
            'ftc-match-uploader_cancel',
            '(FTC) Stop recording a match but cancel uploading to YouTube',
            stop_recording_and_cancel)

        # load saved hotkey data
        obs.obs_hotkey_load(hotkeys['start'], hotkey_start)
        obs.obs_hotkey_load(hotkeys['stop'], hotkey_stop)
        obs.obs_hotkey_load(hotkeys['cancel'], hotkey_cancel)

        # release data references
        obs.obs_data_array_release(hotkey_start)
        obs.obs_data_array_release(hotkey_stop)
        obs.obs_data_array_release(hotkey_cancel)
def script_load(settings):
    """
    Connect hotkey and activation/deactivation signal callbacks
    """

    _sh = obs.obs_get_signal_handler()
    obs.signal_handler_connect(_sh, "source_activate", source_activated)
    obs.signal_handler_connect(_sh, "source_deactivate", source_deactivated)

    _hotkey_id = obs.obs_hotkey_register_frontend("reset_timer_thingy",
                                                  "Reset Timer", reset)

    _hotkey_save_array = obs.obs_data_get_array(settings, "reset_hotkey")
    obs.obs_hotkey_load(_hotkey_id, _hotkey_save_array)
    obs.obs_data_array_release(_hotkey_save_array)
예제 #21
0
def script_load(settings):
    # create hotkey settings in OBS
    global increment_hotkey_id, decrement_hotkey_id, counter_filepath

    # increment hotkey
    increment_hotkey_id = obs.obs_hotkey_register_frontend(
        script_path(), "PSCounter Up", on_increment_hotkey)
    increment_hotkey_save_array = obs.obs_data_get_array(
        settings, counter_increment_hotkey)
    obs.obs_hotkey_load(increment_hotkey_id, increment_hotkey_save_array)
    obs.obs_data_array_release(increment_hotkey_save_array)

    # decrement hotkey
    decrement_hotkey_id = obs.obs_hotkey_register_frontend(
        script_path(), "PSCounter Down", on_decrement_hotkey)
    decrement_hotkey_save_array = obs.obs_data_get_array(
        settings, counter_decrement_hotkey)
    obs.obs_hotkey_load(decrement_hotkey_id, decrement_hotkey_save_array)
    obs.obs_data_array_release(decrement_hotkey_save_array)

    # create counter file if it doesn't exist
    counter_filepath = obs.obs_data_get_string(settings, file_path_setting)
    create_count_file()
    print("*** PSCounter loaded! ***")
예제 #22
0
 def register_hotkey(self):
     description = "Htk " + str(self._id)
     self.hotkey_id = obs.obs_hotkey_register_frontend(
         "htk_id" + str(self._id), description, self.callback)
     obs.obs_hotkey_load(self.hotkey_id, self.hotkey_saved_key)
예제 #23
0
def script_load(settings):
  global hotkey_id
  hotkey_id = obs.obs_hotkey_register_frontend(script_path(), "Source Shake", on_shake_hotkey)
  hotkey_save_array = obs.obs_data_get_array(settings, "shake_hotkey")
  obs.obs_hotkey_load(hotkey_id, hotkey_save_array)
  obs.obs_data_array_release(hotkey_save_array)