コード例 #1
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)
コード例 #2
0
def script_load(settings):
    global hotkey_id_tog
    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)
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)
コード例 #4
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)
コード例 #6
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)
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)
コード例 #8
0
ファイル: client.py プロジェクト: s00500/chorus-client
    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)
コード例 #9
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
コード例 #10
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})
コード例 #11
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)
コード例 #12
0
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)
コード例 #13
0
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)
コード例 #14
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()
コード例 #15
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)
コード例 #16
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! ***")
コード例 #17
0
    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)
コード例 #18
0
ファイル: hotkey_counter.py プロジェクト: upgradeQ/Obscounter
 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)
コード例 #19
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)