def update(self): global globSettings self.selection['menu'].delete(0, 'end') for choice in self.scenes: self.selection['menu'].add_command(label=choice, command=tk._setit( self.scene, choice)) stored = obs.obs_data_get_string(globSettings, "scene") if stored in self.scenes: self.scene.set(stored) else: self.scene.set(self.scenes[0]) self.list.delete(0, self.list.index('end')) self.duration.set(obs.obs_data_get_int(globSettings, "duration")) templates = obs.obs_data_get_array(globSettings, "templates" + self.scene.get()) if templates == None: template = obs.obs_data_array_create() obs.obs_data_set_array(globSettings, "templates" + self.scene.get(), template) length = obs.obs_data_array_count(templates) for i in range(length): item = obs.obs_data_array_item(templates, i) self.list.insert( 'end', obs.obs_data_get_string(item, "id") + ". " + obs.obs_data_get_string(item, "name")) obs.obs_data_release(item) obs.obs_data_array_release(templates)
def script_save(settings): """ Save state for script """ _hotkey_save_array = obs.obs_hotkey_save(script_state.hotkey_id) obs.obs_data_set_array(settings, "reset_hotkey", _hotkey_save_array) obs.obs_data_array_release(_hotkey_save_array)
def script_save(settings): hotkey_save_array = obs.obs_hotkey_save(hotkey_id_tog) obs.obs_data_set_array(settings, HOTKEY_NAME_TOG, hotkey_save_array) obs.obs_data_array_release(hotkey_save_array) hotkey_save_array = obs.obs_hotkey_save(hotkey_id_freeze) obs.obs_data_set_array(settings, HOTKEY_NAME_FREEZE, hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def script_save(settings): restore_sceneitem_after_shake() obs.obs_save_sources() # Hotkey save hotkey_save_array = obs.obs_hotkey_save(hotkey_id) obs.obs_data_set_array(settings, "shake_hotkey", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def script_save(settings): hotkey_save_array = obs.obs_hotkey_save(zoom_id_tog) obs.obs_data_set_array(settings, ZOOM_NAME_TOG, hotkey_save_array) obs.obs_data_array_release(hotkey_save_array) hotkey_save_array = obs.obs_hotkey_save(follow_id_tog) obs.obs_data_set_array(settings, FOLLOW_NAME_TOG, hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def update_match_video(): global last_video_path print('update_match_video') # TODO: actually set the video starting at the start of the game, rather # than the slot. Also involves ensuring that our timings are in step with # the compbox. path = video_path.get() if last_video_path == path: print(f"{path!r} has already played") return # TODO: can we pull the current video from the source? I tried this but # couldn't work out how. last_video_path = path print(f"Updating to {path!r}") source = obs.obs_get_source_by_name(source_name) if source != None: print('got source') settings = obs.obs_data_create() source_id = obs.obs_source_get_id(source) if source_id == "ffmpeg_source": obs.obs_data_set_string(settings, "local_file", path) obs.obs_data_set_bool(settings, "is_local_file", True) # updating will automatically cause the source to # refresh if the source is currently active obs.obs_source_update(source, settings) # TODO: this ends up resetting the size of the video within OBS. Can # we inspect the source beforehand and preserve the apparent size? # Might be moot if all our videos are the same size and we're # showing them at 100% scale, but would be good to sort properly. elif source_id == "vlc_source": # "playlist" array = obs.obs_data_array_create() item = obs.obs_data_create() obs.obs_data_set_string(item, "value", path) obs.obs_data_array_push_back(array, item) obs.obs_data_set_array(settings, "playlist", array) # updating will automatically cause the source to # refresh if the source is currently active obs.obs_source_update(source, settings) obs.obs_data_release(item) obs.obs_data_array_release(array) obs.obs_data_release(settings) obs.obs_source_release(source) print('update_match_video done')
def script_save(settings): #streamMsgDispNext hotkey_save_array = obs.obs_hotkey_save(config.dispNext_hotkey_id) obs.obs_data_set_array(settings, "streamMsgDispNext", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array) #streamMsgDispPrev hotkey_save_array = obs.obs_hotkey_save(config.dispPrev_hotkey_id) obs.obs_data_set_array(settings, "streamMsgDispPrev", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def script_save(settings): global HOTKEY_ID_COUNT_UP global HOTKEY_ID_RESET hotkey_save_array_count_up = obs.obs_hotkey_save(HOTKEY_ID_COUNT_UP) hotkey_save_array_reset = obs.obs_hotkey_save(HOTKEY_ID_RESET) obs.obs_data_set_array(settings, "count_up_hotkey", hotkey_save_array_count_up) obs.obs_data_set_array(settings, "reset_hotkey", 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_save(settings): # save the hotkey info # increment hotkey increment_hotkey_save_array = obs.obs_hotkey_save(increment_hotkey_id) obs.obs_data_set_array(settings, counter_increment_hotkey, increment_hotkey_save_array) obs.obs_data_array_release(increment_hotkey_save_array) # decrement hotkey decrement_hotkey_save_array = obs.obs_hotkey_save(decrement_hotkey_id) obs.obs_data_set_array(settings, counter_decrement_hotkey, decrement_hotkey_save_array) obs.obs_data_array_release(decrement_hotkey_save_array)
def change_input(): global globSettings url = obs.obs_data_get_string(globSettings, "url") source = obs.obs_data_get_string(globSettings, "source") qual = obs.obs_data_get_string(globSettings, "res") if url != None and source != None: sourceObj = obs.obs_get_source_by_name(source) try: streamUrl = "" stream = streamlink.streams(url) if qual in stream: streamUrl = stream[qual].url elif qual + "60" in stream: streamUrl = stream[qual + "60"].url elif qual + "_alt" in stream: streamUrl = stream[qual + "_alt"].url elif qual + "60_alt" in stream: streamUrl = stream[qual + "60_alt"].url elif "best" in stream: streamUrl = stream["best"].url if streamUrl != "" and sourceObj != None: source_id = obs.obs_source_get_id(sourceObj) settings = obs.obs_data_create() if source_id == "ffmpeg_source": obs.obs_data_set_string(settings, "input", streamUrl) obs.obs_data_set_bool(settings, "is_local_file", False) obs.obs_source_update(sourceObj, settings) else: array = obs.obs_data_array_create() data = obs.obs_data_create() obs.obs_data_set_string(data, "name", streamUrl) obs.obs_data_set_string(data, "value", streamUrl) obs.obs_data_array_push_back(array, data) obs.obs_data_release(data) obs.obs_data_set_array(settings, "playlist", array) obs.obs_source_update(sourceObj, settings) obs.obs_data_array_release(array) obs.obs_data_release(settings) except streamlink.StreamlinkError: pass obs.obs_source_release(sourceObj)
def add(self): global globSettings loc = filedialog.askopenfilename(filetypes=[("JSON", "*.json")], title="Open Template File") templates = obs.obs_data_get_array(globSettings, "templates" + self.scene.get()) if templates == None: template = obs.obs_data_array_create() obs.obs_data_set_array(globSettings, "templates" + self.scene.get(), template) new = obs.obs_data_create() length = obs.obs_data_array_count(templates) + 1 obs.obs_data_set_string(new, "id", str(length)) obs.obs_data_set_string(new, "name", os.path.basename(loc)) obs.obs_data_set_string(new, "loc", loc) obs.obs_data_array_push_back(templates, new) obs.obs_data_release(new) obs.obs_data_array_release(templates) self.list.insert('end', str(length) + ". " + os.path.basename(loc))
def script_save(settings): # save hotkey data hotkey_start = obs.obs_hotkey_save(hotkeys['start']) hotkey_stop = obs.obs_hotkey_save(hotkeys['stop']) hotkey_cancel = obs.obs_hotkey_save(hotkeys['cancel']) # set hotkey data obs.obs_data_set_array(settings, 'hotkey_start', hotkey_start) obs.obs_data_set_array(settings, 'hotkey_stop', hotkey_stop) obs.obs_data_set_array(settings, 'hotkey_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_save(settings): #Save hotkeys for hotkeyId in hotkeyDict: save_array = obs.obs_hotkey_save(hotkeyDict[hotkeyId]["id"]) obs.obs_data_set_array(settings, hotkeyId, save_array) obs.obs_data_array_release(save_array)
def script_save(settings): global HOTKEY_ID hotkey_save_array = obs.obs_hotkey_save(HOTKEY_ID) obs.obs_data_set_array(settings, "scripted_text_hotkey", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def save_hotkey(self): self.hotkey_saved_key = obs.obs_hotkey_save(self.hotkey_id) obs.obs_data_set_array(self.obs_data, "htk_id" + str(self._id), self.hotkey_saved_key) obs.obs_data_array_release(self.hotkey_saved_key)
def script_save(settings): global HOTKEY_ID hotkey_save_array_htk = S.obs_hotkey_save(HOTKEY_ID) S.obs_data_set_array(settings, "htk_hotkey", hotkey_save_array_htk) S.obs_data_array_release(hotkey_save_array_htk)
def save_hotkey(self): self.hotkey_saved_key = obs.obs_hotkey_save(self.hotkey_id) obs.obs_data_set_array(self.obs_data, "chat_hotkey_" + str(self.position), self.hotkey_saved_key)
def _set_list(data, key, obj): o = _make_list(obj) try: _obs.obs_data_set_array(data, key, o) finally: _obs.obs_data_release(o)
def script_save(settings): hotkey_save_array_scripted_text = obs.obs_hotkey_save( scripted_text_driver.hotkey_id_scripted_text) obs.obs_data_set_array(settings, "scripted_text_hotkey", hotkey_save_array_scripted_text) obs.obs_data_array_release(hotkey_save_array_scripted_text)
def script_save(settings): for hot_key in hot_keys: save_key = obs.obs_hotkey_save(hot_key['scene_id']) obs.obs_data_set_array(settings, hot_key['name'], save_key)
def script_save(settings): hotkey_save_array = obs.obs_hotkey_save(hotkey) obs.obs_data_set_array(settings, "SlideDisplay.hotkey.show", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)
def script_save(settings): # save the hotkey info hotkey_save_array = obs.obs_hotkey_save(hotkey_id) obs.obs_data_set_array(settings, "timestamp_hotkey", hotkey_save_array) obs.obs_data_array_release(hotkey_save_array)