def script_update(settings): global currentMidiPort global midiin global midiParams askedPort = obs.obs_data_get_string(settings, "midiDevice") if currentMidiPort != askedPort: if currentMidiPort != "": midiin.close_port() currentMidiPort = "" ok = True if askedPort != "": try: midiin, port_name = open_midiinput(askedPort) midiin.set_callback(MidiInputHandler(port_name)) except (EOFError, KeyboardInterrupt): print("Meh :/") ok = False if ok: currentMidiPort = askedPort midiParams[0] = obs.obs_data_get_string(settings, "transitionMidiType") midiParams[1] = obs.obs_data_get_int(settings, "transitionMidiAddress") midiParams[2] = obs.obs_data_get_string(settings, "scenesMidiType") midiParams[3] = obs.obs_data_get_int(settings, "scenesMidiAddress") midiParams[4] = obs.obs_data_get_string(settings, "transitionsMidiType") midiParams[5] = obs.obs_data_get_int(settings, "transitionsMidiAddress") midiParams[6] = obs.obs_data_get_bool(settings, "logMidiInput")
def delete_google_authentication(prop=None, props=None): print(f'Deleting Google authentication') metadata_fd, metadata_path = tempfile.mkstemp(suffix='.json', text=True) with os.fdopen(metadata_fd, 'w') as metadata_f: json.dump( { 'google_project_id': obs.obs_data_get_string(settings, 'google_project_id'), 'google_client_id': obs.obs_data_get_string(settings, 'google_client_id'), 'google_client_secret': obs.obs_data_get_string(settings, 'google_client_secret'), }, metadata_f) print(f' Metadata Path: {metadata_path}') log_fd, log_path = tempfile.mkstemp(suffix='.txt') print(f' Log Path: {log_path}') children.append( (subprocess.Popen([python_path, __file__, 'delete', metadata_path], stdin=subprocess.DEVNULL, stdout=log_fd, stderr=subprocess.STDOUT), log_path)) os.close(log_fd) print()
def script_update(settings): global enabled global display_text global check_frequency global source_name global debug_mode debug("[CS] Updated properties.") if obs.obs_data_get_bool(settings, "enabled"): if not enabled: debug("[CS] Enabled song timer.") enabled = True obs.timer_add(get_song_info, check_frequency) else: if enabled: debug("[CS] Disabled song timer.") enabled = False obs.timer_remove(get_song_info) debug_mode = obs.obs_data_get_bool(settings, "debug_mode") display_text = obs.obs_data_get_string(settings, "display_text") source_name = obs.obs_data_get_string(settings, "source_name") check_frequency = obs.obs_data_get_int(settings, "check_frequency") for i in filter(lambda x: not x.startswith('_'), calcingfunc.keys()): globals()[i].state = obs.obs_data_get_bool(settings, globals()[i].id)
def script_update(settings): global debug_mode if debug_mode: print("Updated properties for Corvinus Now Playing") global enabled global display_text global alt_display_text global latency global source_name global output_buffer debug_mode = obspython.obs_data_get_bool(settings, "enabled") debug_mode = obspython.obs_data_get_bool(settings, "debug_mode") output_buffer = obspython.obs_data_get_int(settings, "output_buffer") display_text = obspython.obs_data_get_string(settings, "display_text") alt_display_text = obspython.obs_data_get_string(settings, "alt_display_text") latency = obspython.obs_data_get_int(settings, "latency") source_name = obspython.obs_data_get_string(settings, "source_name") if obspython.obs_data_get_bool(settings, "enabled") is True: if (not enabled): if debug_mode: print("Enabled song timer for Corvinus Now Playing") enabled = True obspython.timer_add(get_song_info, latency) else: if (enabled): if debug_mode: print("Disabled song timer for Corvinus Now Playing") enabled = False obspython.timer_remove(get_song_info)
def script_update(settings): global g g.settings = settings global slide_scene slide_scene = obs.obs_data_get_string(settings, "slide_scene") global monitors monitors = [] for hMonitor, hdcMonitor, pyRect in win32api.EnumDisplayMonitors(): monitors.append(Monitor(hMonitor, hdcMonitor, pyRect, win32api.GetMonitorInfo(hMonitor)["Device"])) global monitor monitor = obs.obs_data_get_int(settings, "monitor") global screen_sourcename screen_sourcename = obs.obs_data_get_string(settings, "screen_sourcename") global slide_visible_duration slide_visible_duration = obs.obs_data_get_int(settings, "slide_visible_duration") global fadeout_duration fadeout_duration = obs.obs_data_get_double(settings, "fadeout_duration") global refresh_interval refresh_interval = obs.obs_data_get_double(settings, "refresh_interval") global camera_sourcename camera_sourcename = obs.obs_data_get_string(settings, "camera_sourcename")
def script_update(settings): global cal_url global interval global source_names global CLIENT_SECRET_FILE global max_events global images_path global image_sources cal_url = obs.obs_data_get_string(settings, "calendar_url") CLIENT_SECRET_FILE = obs.obs_data_get_string(settings, "client_secret_file") images_path = obs.obs_data_get_string(settings, "images_path") interval = obs.obs_data_get_int(settings, "interval") max_events = obs.obs_data_get_int(settings, "max_events") source_names = [None] * max_events for x in range(0, max_events): source_names[x] = obs.obs_data_get_string(settings, "source_{}".format(x)) image_sources = [None] * max_events for x in range(0, max_events): image_sources[x] = obs.obs_data_get_string(settings, "img_source_{}".format(x)) obs.timer_remove(update_text) if cal_url != "": #and source_name != "": obs.timer_add(update_text, interval * 1000)
def script_update(settings): global source_1_name global source_2_name global background_name global transition_time global host global port global password global autoconnect global thread_running source_1_name = obs.obs_data_get_string(settings, "source 1") create_colorcorrection_filter(source_1_name, COLOR_FILTER_NAME) source_2_name = obs.obs_data_get_string(settings, "source 2") create_colorcorrection_filter(source_2_name, COLOR_FILTER_NAME) background_name = obs.obs_data_get_string(settings, "background") create_colorcorrection_filter(background_name, COLOR_FILTER_NAME) transition_time = obs.obs_data_get_double(settings, "transition_time") host = obs.obs_data_get_string(settings, "host") port = obs.obs_data_get_int(settings, "port") password = obs.obs_data_get_string(settings, "password") tmpAutoconnect = obs.obs_data_get_bool(settings, "autoconnect") if not autoconnect and tmpAutoconnect: autoconnect = tmpAutoconnect if not thread_running: t = threading.Thread(target=connect) t.daemon = True t.start() q.put(0) thread_running = True else: autoconnect = tmpAutoconnect
def script_update(settings): global debug_mode if debug_mode: print("OBSBuffer Updated properties.") global enabled global display_text global check_frequency global source_presenter global source_time global json_filename global source_title global check_frequency if obs.obs_data_get_bool(settings, "enabled") is True: if (not enabled): if debug_mode: print("OBSBuffer Enabled buffer timer.") enabled = True obs.timer_add(update_content, check_frequency) else: if (enabled): if debug_mode: print("OBSBuffer Disabled buffer timer.") enabled = False obs.timer_remove(update_content) debug_mode = obs.obs_data_get_bool(settings, "debug_mode") source_presenter = obs.obs_data_get_string(settings, "source_presenter") source_title = obs.obs_data_get_string(settings, "source_title") source_time = obs.obs_data_get_string(settings, "source_time") check_frequency = obs.obs_data_get_int(settings, "check_frequency") json_filename = obs.obs_data_get_int(settings, "json_filename")
def script_load(settings): global new_state if DEBUG: obs.script_log( obs.LOG_WARNING, "I'm joined to the party") new_state["api_endpoint"] = obs.obs_data_get_string( settings, "api_endpoint") new_state["jsonpath"] = obs.obs_data_get_string(settings, "jsonpath").replace(" ", "").strip() if "," in new_state["jsonpath"]: new_state["jsonpath"] = new_state["jsonpath"].split(",") new_state["text_source"] = obs.obs_data_get_string(settings, "text_source") new_state["format_rule"] = obs.obs_data_get_string(settings, "format_rule") if type(new_state["jsonpath"]) == str: new_state["format_args"] = [""] elif type(new_state["jsonpath"]) in [list, tuple]: new_state["format_args"] = [] for _ in new_state["jsonpath"]: new_state["format_args"].append("") if DEBUG: obs.script_log( obs.LOG_WARNING, f"{new_state}") save_pressed(None, None)
def script_update(settings): sleep_countdown.source_name = obs.obs_data_get_string(settings, 'source') Data._format_ = obs.obs_data_get_string(settings, 'format') Data._autoStart_ = obs.obs_data_get_bool(settings, 'auto_start') #force the text to update and do not increment the timer sleep_countdown.update_text(True, False)
def recording_start_handler(_): global is_being_recorded global path global name is_being_recorded = True logger.info(f'recording started ({now()})') output_settings = obs.obs_output_get_settings(output) logger.debug(obs.obs_data_get_json(output_settings)) """ Example path: "C:/Users/Admin/Documents/2019-04-04 16-02-28.flv" After `os.path.split(path)`: ('C:/Users/Admin/Documents', '2019-04-04 16-02-28.flv')""" raw_path = obs.obs_data_get_string(output_settings, "path") print(f"Raw path: '{raw_path}'") if raw_path == "": logging.info('Path is empty when starting recording, trying to use "url" if you\'re using FFmpeg!') raw_path = obs.obs_data_get_string(output_settings, "url") print(f"Raw path: '{raw_path}'") if raw_path == "": logging.error('Switched to "url" when "path" was not working, but still didn\'t get anything!') video_path_tuple = os.path.split(raw_path) video_name = video_path_tuple[-1] path = video_path_tuple[0] # Convert extension to txt from .flv name = os.path.splitext(video_name)[0] + '.txt' if not cached_settings["use_default_fps"]: global SHOULD_EXIT SHOULD_EXIT = False logger.info('Starting recording using custom FPS settings.') threading.Thread(target=cursor_recorder).start()
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_update(settings): global enabled global display_text global check_frequency global source_name global debug_mode if debug_mode: print("[CS] 设置已更新。") if obs.obs_data_get_bool(settings, "enabled") is True: if not enabled: if debug_mode: print("[CS] Enabled song timer.") enabled = True obs.timer_add(get_song_info, check_frequency) else: if enabled: if debug_mode: print("[CS] Disabled song timer.") enabled = False obs.timer_remove(get_song_info) debug_mode = obs.obs_data_get_bool(settings, "debug_mode") display_text = obs.obs_data_get_string(settings, "display_text") source_name = obs.obs_data_get_string(settings, "source_name") check_frequency = obs.obs_data_get_int(settings, "check_frequency") customset['spotify'] = obs.obs_data_get_bool(settings, "spotify") customset['vlc'] = obs.obs_data_get_bool(settings, "vlc") customset['yt_firefox'] = obs.obs_data_get_bool(settings, "yt_firefox") customset['yt_chrome'] = obs.obs_data_get_bool(settings, "yt_chrome") customset['foobar2000'] = obs.obs_data_get_bool(settings, "foobar2000") customset['necloud'] = obs.obs_data_get_bool(settings, "necloud") customset['aimp'] = obs.obs_data_get_bool(settings, "aimp")
def script_update(settings): global audio_source_name, image_source_name audio_source_name = obs.obs_data_get_string(settings, "audio_source") image_source_name = obs.obs_data_get_string(settings, "image_source") if sources_loaded: create_muted_callback(audio_source_name) # create 'muted' callback for source
def script_update(settings): global replays_dir global dolphin global melee replays_dir = obs.obs_data_get_string(settings, 'replays') dolphin = obs.obs_data_get_string(settings, 'dolphin') melee = obs.obs_data_get_string(settings, 'melee')
def script_update(updatedSettings): """ Called when the script’s settings (if any) have been changed by the user. """ global source_name global scene_item global animationCount global Server global Animations global settings global props print("Script Update Called") try: settings = updatedSettings source_name = obs.obs_data_get_string(settings, "source") animationCount = obs.obs_data_get_int(settings, "animationCount") Server.address = obs.obs_data_get_string(settings, Server.addressStorage) Server.port = obs.obs_data_get_int(settings, Server.portStorage) restoreAnimations(settings) #only remove/add events if our server thread is failing. #serverThreadFound = False #main_thread = threading.current_thread() # for t in threading.enumerate(): # if t is main_thread or t.getName().startswith('Dummy'): # print('Main/Dummy Thread with name %s, id %s' % (t.getName(), t.ident)) # continue # print('Thread with name %s, id %s' % (t.getName(), t.ident)) # if t != None: # Server.threadId = t.ident # serverThreadFound = True # break Server.run = False #Server.checkServer() Source.processingAnimation = False obs.timer_remove(adjustCameraTick) obs.timer_add(adjustCameraTick, UpdateRateMs) obs.timer_remove(check_Server) obs.timer_add(check_Server, 10000) obs.timer_remove(ping_Server) # # # Time is in ms. obs.timer_add(ping_Server, (Server.closeIfNoPingInXSeconds - 1) * 1000) obs.obs_frontend_remove_event_callback(frontend_event) obs.obs_frontend_add_event_callback(frontend_event) except Exception as e: print("Exception from script_update: %s" % (e))
def script_update(settings): global source_name global g_time_fmt source_name = obs.obs_data_get_string(settings, "source") update_rate = obs.obs_data_get_int(settings, "update_rate") g_time_fmt = obs.obs_data_get_string(settings, "format") obs.timer_add(update_text, update_rate)
def script_update(settings): access_token = obs.obs_data_get_string(settings, "access_token") nickname = obs.obs_data_get_string(settings, "nickname") print("Nickname: {}".format(nickname)) if access_token is not None: bot.set_access_token(access_token) if nickname is not None: bot.set_nickname(nickname)
def script_update(settings): global is_active, scene_names, left_width, check_freq is_active = obs.obs_data_get_bool(settings, "is_active") scene_names[0] = obs.obs_data_get_string(settings, "scene_for_left_mon") scene_names[1] = obs.obs_data_get_string(settings, "scene_for_right_mon") left_width = obs.obs_data_get_int(settings, "left_width") check_freq = obs.obs_data_get_int(settings, "check_freq") obs.timer_remove(switch_scenes) if is_active: obs.timer_add(switch_scenes, check_freq)
def script_update(settings): Settings.countdown_time = datetime.time( obs.obs_data_get_int(settings, "hour"), obs.obs_data_get_int(settings, "minute"), obs.obs_data_get_int(settings, "second")) Settings.source_name = obs.obs_data_get_string(settings, "source_name") Settings.stop_text = obs.obs_data_get_string(settings, "stop_text") start_timer()
def script_update(settings): liveTime.source_name = obs.obs_data_get_string(settings, "source") Data._format_ = obs.obs_data_get_string(settings, "format") Data._autoStart_ = obs.obs_data_get_bool(settings, "auto_start") Data._autoStop_ = obs.obs_data_get_bool(settings, "auto_stop") Data._recording_ = obs.obs_data_get_bool(settings, "recording") Data._visible_ = obs.obs_data_get_bool(settings, "visible") #force the text to update and do not increment the timer liveTime.update_text(True, False)
def script_update(settings): hotkeys_counter_1.source_name = obs.obs_data_get_string( settings, "source1") hotkeys_counter_1.counter_text = obs.obs_data_get_string( settings, "counter_text1") hotkeys_counter_2.source_name = obs.obs_data_get_string( settings, "source2") hotkeys_counter_2.counter_text = obs.obs_data_get_string( settings, "counter_text2")
def script_update(settings): global song_directories global text_source_name global target_scene global group_name song_directories = obs.obs_data_get_string(settings, "path") text_source_name = obs.obs_data_get_string(settings, "text_source_list") target_scene = obs.obs_data_get_string(settings, "scene") group_name = obs.obs_data_get_string(settings, "group") update_text()
def script_update(settings): global Debug_Mode if Debug_Mode: print("Calling Update") global Enabled_Recording global Enabled_Streaming global Pause_Time global Recording_Start global Recording_Timer global Recording_End global Time_To_Record global Avoid_These_Days if obs.obs_data_get_bool(settings, "enabled") is not Enabled_Recording: if obs.obs_data_get_bool(settings, "enabled") is True: if Debug_Mode: print("Loading Timer") print("timer_check_recording(): [{}] vs [{}]".format( str(datetime.today().strftime("%a")), Avoid_These_Days)) Enabled_Recording = True obs.timer_add(timer_check_recording, 30000) else: if Debug_Mode: print("Unloading Timer") Enabled_Recording = False obs.timer_remove(timer_check_recording) if obs.obs_data_get_int(settings, "duration") == 0: Recording_Timer = 30 * 60 else: Recording_Timer = obs.obs_data_get_int(settings, "duration") * 60 Time_To_Record = time.time() + Recording_Timer if obs.obs_data_get_string( settings, "start_time") == "" or obs.obs_data_get_string( settings, "start_time") == "None" or obs.obs_data_get_string( settings, "start_time") == obs.obs_data_get_string( settings, "end_time"): Recording_Start = "None" obs.obs_data_set_bool(settings, "enabled_stream", False) Enabled_Streaming = False else: Recording_Start = obs.obs_data_get_string(settings, "start_time") if obs.obs_data_get_string(settings, "end_time") == "": Recording_Start = "None" obs.obs_data_set_bool(settings, "enabled_stream", False) Enabled_Streaming = False else: Recording_End = obs.obs_data_get_string(settings, "end_time") if obs.obs_data_get_string(settings, "avoid_days") == "": Avoid_These_Days = "Sat Sun" obs.obs_data_set_bool(settings, "enabled_stream", False) Enabled_Streaming = False else: Avoid_These_Days = obs.obs_data_get_string(settings, "avoid_days") Debug_Mode = obs.obs_data_get_bool(settings, "debug_mode") Enabled_Streaming = obs.obs_data_get_bool(settings, "enabled_stream")
def script_update(settings): global time_input global source_name time_input = obs.obs_data_get_string(settings, "time_input") source_name = obs.obs_data_get_string(settings, "source") obs.timer_remove(update_text) if time_input != "" and source_name != "": obs.timer_add(update_text, 1000)
def script_update(settings): global clock_24hr global timezone_text global source_name clock_24hr = obs.obs_data_get_bool(settings, "clock_24hr") timezone_text = obs.obs_data_get_string(settings, "timezone_text") source_name = obs.obs_data_get_string(settings, "source_name") if source_name != "": set_timer_interval()
def script_update_qualifier_settings(settings, rtgg_obs: RacetimeObs): rtgg_obs.qualifier.enabled = obs.obs_data_get_bool(settings, "use_qualifier") rtgg_obs.qualifier.qualifier_cutoff = obs.obs_data_get_int( settings, "qualifier_cutoff") rtgg_obs.logger.debug( f"qualifier_cutoff is {rtgg_obs.qualifier.qualifier_cutoff}") rtgg_obs.qualifier.par_source = obs.obs_data_get_string( settings, "qualifier_par_source") rtgg_obs.qualifier.score_source = obs.obs_data_get_string( settings, "qualifier_score_source")
def script_load(settings): global status_file global idle_scene global playing_scene status_file = obs.obs_data_get_string(settings, 'status_file') idle_scene = obs.obs_data_get_string(settings, 'idle_scene') playing_scene = obs.obs_data_get_string(settings, 'playing_scene') # Delay check valid source until OBS is fully loaded obs.script_log(obs.LOG_INFO, 'Starting in 10 seconds...') obs.timer_add(validate_and_start, 10000)
def script_update(settings): global interval global source_name global file_path interval = obs.obs_data_get_int(settings, "interval") source_name = obs.obs_data_get_string(settings, "source") file_path = obs.obs_data_get_string(settings, "file") obs.timer_remove(update_text) if file_path != "" and source_name != "": obs.timer_add(update_text, interval * 1000)
def script_update(settings): zoom.refresh_rate = obs.obs_data_get_int(settings, "interval") zoom.source_name = obs.obs_data_get_string(settings, "source") zoom.zoom_w = obs.obs_data_get_int(settings, "Width") zoom.zoom_h = obs.obs_data_get_int(settings, "Height") zoom.active_border = obs.obs_data_get_double(settings, "Border") zoom.max_speed = obs.obs_data_get_int(settings, "Speed") zoom.smooth = obs.obs_data_get_double(settings, "Smooth") zoom.zoom_d = obs.obs_data_get_double(settings, "Zoom") zoom.switch_to_monitor(obs.obs_data_get_string(settings, "Monitor")) zoom.d_w_override = obs.obs_data_get_int(settings, "Manual Monitor Width") zoom.d_h_override = obs.obs_data_get_int(settings, "Manual Monitor Height")
def script_update(settings): global url global interval global source_name url = obs.obs_data_get_string(settings, "url") interval = obs.obs_data_get_int(settings, "interval") source_name = obs.obs_data_get_string(settings, "source") obs.timer_remove(update_text) if url != "" and source_name != "": obs.timer_add(update_text, interval * 1000)