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_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 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 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 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_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): 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 starturl global stopurl global enable_rec global enable_stream global interval starturl = obs.obs_data_get_string(settings, "starturl") stopurl = obs.obs_data_get_string(settings, "stopurl") enable_rec = obs.obs_data_get_bool(settings, "enablerec") enable_stream = obs.obs_data_get_bool(settings, "enablestream") interval = obs.obs_data_get_int(settings, "interval")
def script_update(settings): global wf global rf global cb global df global af global al wf = obs.obs_data_get_string(settings, "wf") rf = obs.obs_data_get_string(settings, "rf") cb = obs.obs_data_get_bool(settings, "cb") df = obs.obs_data_get_string(settings, "df") af = obs.obs_data_get_string(settings, "af") al = obs.obs_data_get_bool(settings, "al")
def script_update_media_player_settings(settings, rtgg_obs: RacetimeObs): rtgg_obs.media_player.play_media_callback = play_sound rtgg_obs.media_player.enabled = obs.obs_data_get_bool( settings, "use_media_player") rtgg_obs.media_player.monitoring_type = obs.obs_data_get_int( settings, "monitoring_type") rtgg_obs.media_player.ping_chat_messages = obs.obs_data_get_bool( settings, "use_chat_pings") rtgg_obs.media_player.chat_media_file = obs.obs_data_get_string( settings, "chat_ping_sound") first_place_sound = obs.obs_data_get_string(settings, "first_place_sound") if first_place_sound is not None and first_place_sound != "": rtgg_obs.media_player.remove_trigger(0) rtgg_obs.media_player.add_trigger(first_place_sound, place_trigger=1) rtgg_obs.media_player.play_media_callback = play_sound
def script_update(settings): global Debug_Mode global cmd print("Calling Update") if obs.obs_data_get_bool(settings, "enabled") is True: print("Loading Timer") cmd = start_client() obs.timer_add(timer_check_recording, 100) else: print("Unloading Timer") obs.timer_remove(timer_check_recording) Debug_Mode = obs.obs_data_get_bool(settings, "debug_mode")
def restoreAnimations(settings): #print("Restoring Animation with new animation count of %s" % (animationCount)) Animations.clear() for i in range(animationCount): # Create animations based on stored stuff. animation = Animation(i) animation.variationType = obs.obs_data_get_int( settings, animation.variationTypeStorage) animation.customStartingSetting = obs.obs_data_get_bool( settings, animation.customStartingSettingStorage) # Get Starting Position and Scale animation.startingX = obs.obs_data_get_int(settings, animation.startingXStorage) animation.startingY = obs.obs_data_get_int(settings, animation.startingYStorage) animation.startingWidth = obs.obs_data_get_int( settings, animation.startingWidthStorage) animation.startingHeight = obs.obs_data_get_int( settings, animation.startingHeightStorage) animation.movementType = obs.obs_data_get_int( settings, animation.movementTypeStorage) animation.duration = obs.obs_data_get_int(settings, animation.durationStorage) animation.posSpeed = obs.obs_data_get_int(settings, animation.posSpeedStorage) # Get Destination Position and Scale animation.destinationX = obs.obs_data_get_int( settings, animation.destinationXStorage) animation.destinationY = obs.obs_data_get_int( settings, animation.destinationYStorage) animation.destinationWidth = obs.obs_data_get_int( settings, animation.destinationWidthStorage) animation.destinationHeight = obs.obs_data_get_int( settings, animation.destinationHeightStorage) animation.posDirection = obs.obs_data_get_int( settings, animation.posDirectionStorage) animation.changeSizeInPlace = obs.obs_data_get_bool( settings, animation.changeSizeInPlaceStorage) animation.command = obs.obs_data_get_string(settings, animation.commandStorage) animation.stopCommand = obs.obs_data_get_string( settings, animation.stopCommandStorage) Animations.append(animation)
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 script_update(settings): global scene_name global source_name global reset_time global stop_stream global stop_stream_time scene_name = obs.obs_data_get_string(settings, "scene") source_name = obs.obs_data_get_string(settings, "source") reset_time = obs.obs_data_get_bool(settings, "reset_time") stop_stream = obs.obs_data_get_bool(settings, "stop_stream") stop_stream_time = obs.obs_data_get_int(settings, "stop_stream_time") obs.timer_remove(scene_updater) if scene_name != "" and source_name != "": obs.timer_add(scene_updater, 1000)
def script_load(settings): obs.obs_frontend_add_event_callback(on_event) 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") if not Data._format_: Data._format_ = Data._defaultFormat_ obs.obs_data_set_string(settings, "format", Data._format_) obs.obs_data_set_bool(settings, "auto_start", Data._autoStart_) obs.obs_data_set_bool(settings, "auto_stop", Data._autoStop_) obs.obs_data_set_bool(settings, "recording", Data._recording_) obs.obs_data_set_bool(settings, "visible", Data._visible_)
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 get_audio_sources_from_scene(scene, source_dict=None): if source_dict is None: source_dict = OrderedDict() for sceneitem in obspython.obs_scene_enum_items( obspython.obs_scene_from_source(scene)): item_source = obspython.obs_sceneitem_get_source(sceneitem) name = obspython.obs_source_get_name(item_source) if obspython.obs_source_get_output_flags( item_source) & obspython.OBS_SOURCE_COMPOSITE: source_dict = get_audio_sources_from_scene(item_source, source_dict) if obspython.obs_source_get_output_flags( item_source) & obspython.OBS_SOURCE_AUDIO: source_active = obspython.obs_source_active(item_source) audio_active = obspython.obs_source_audio_active(item_source) priv_settings = obspython.obs_source_get_private_settings( item_source) hidden = obspython.obs_data_get_bool(priv_settings, "mixer_hidden") if not source_active or not audio_active or hidden: continue source_dict[name] = item_source return source_dict
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 script_update(settings): eg.source_name = obs.obs_data_get_string(settings, "source") obs.timer_remove(eg.update_text) if eg.source_name != "": flag = obs.obs_data_get_bool(settings, "_obs_bool") print(flag) eg.update_text = partial(eg.update_text, flag_func=flag) obs.timer_add(eg.update_text, 1 * 1000)
def script_update(settings): std.source_name = obs.obs_data_get_string(settings, "source") std.use_file = obs.obs_data_get_bool(settings, "use_file") std.reload_file = obs.obs_data_get_bool(settings, "reload_file") if not std.use_file: std.scripted_text = obs.obs_data_get_string(settings, "scripted_text") else: std.scripted_text = std.read_file( obs.obs_data_get_string(settings, "file_path") ) std.file_path = obs.obs_data_get_string(settings, "file_path") std.effect = obs.obs_data_get_string(settings, "text_effect") std.refresh_rate = obs.obs_data_get_int(settings, "refresh_rate") std.effect_duration = 1000 * obs.obs_data_get_int(settings, "duration") std.sound_source_name = obs.obs_data_get_string(settings, "playsound") std.layer_source_name = obs.obs_data_get_string(settings, "layer") std.stop_sound()
def script_update(settings): global weekday weekday = obs.obs_data_get_int(settings, "weekday") global event_start event_start = obs.obs_data_get_int(settings, "event_start") global start_scene start_scene = obs.obs_data_get_string(settings, "start_scene") global manage_streaming manage_streaming = obs.obs_data_get_bool(settings, "manage_streaming") global manage_recording manage_recording = obs.obs_data_get_bool(settings, "manage_recording") global preshow_triggered preshow_triggered = False global preshow_duration preshow_duration = obs.obs_data_get_int(settings, "preshow_duration") global text_source text_source = obs.obs_data_get_string(settings, "text_source") global countdown_final_text countdown_final_text = obs.obs_data_get_string(settings, "countdown_final_text") global stop_streaming_delay stop_streaming_delay = obs.obs_data_get_int(settings, "stop_streaming_delay") global stop_recording_delay stop_recording_delay = obs.obs_data_get_int(settings, "stop_recording_delay") global closing_scene closing_scene = obs.obs_data_get_string(settings, "closing_scene") obs.timer_remove(check_start) obs.timer_remove(update_countdown) set_text_source("") if (manage_streaming or manage_recording ) and start_scene != "" and weekday == datetime.now().weekday( ) and diff_time().total_seconds() > 0 and not ( obs.obs_frontend_streaming_active() or obs.obs_frontend_recording_active()): obs.timer_add(check_start, 1000)
def script_load(settings): obs.obs_frontend_add_event_callback(on_event) Data._format_ = obs.obs_data_get_string(settings, 'format') Data._autoStart_ = obs.obs_data_get_bool(settings, 'auto_start') if not Data._format_: Data._format_ = Data._defaultFormat_ obs.obs_data_set_string(settings, 'format', Data._format_) obs.obs_data_set_bool(settings, 'auto_start', Data._autoStart_)
def script_update(settings): global Debug_Mode # if Debug_Mode: print("Calling Update") global enabled_flag 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") Enabled_Recording = True obs.timer_add(timer_check_recording, 1000) else: # if Debug_Mode: print("Unloading Timer") Enabled_Recording = False obs.timer_remove(timer_check_recording) Debug_Mode = obs.obs_data_get_bool(settings, "debug_mode")
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_load(settings): obs.obs_frontend_add_event_callback(on_load) rtgg_obs.timer.use_podium_colors = obs.obs_data_get_bool( settings, "use_podium") rtgg_obs.media_player.last_session_race = obs.obs_data_get_string( settings, "last_session_race") obs.obs_data_set_string(settings, "race", sp.none_races)
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(settings): global debug, source_name debug = obs.obs_data_get_bool(settings, "debug") # for printing debug messages source_name = obs.obs_data_get_string(settings, "source") if sources_loaded: create_muted_callback( source_name) # create 'muted' callback for source
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 deploy_browser_source_server(prop, props): remove_browser_source_server(None, None) obslog(obs.LOG_INFO, "deploy_browser_source_server") isUserConfig = obs.obs_data_get_bool(settings, 'use_user_config') userConfigPath = obs.obs_data_get_string(settings, 'user_config') if isUserConfig: if not userConfigPath: obslog(obs.LOG_WARNING, "Cannot deploy, no user config path specified") raise Exception( "Unable to deploy container, selected use saved config but not path specified" ) try: with open(userConfigPath, errors='replace') as f: json.load(f) except json.JSONDecodeError: obslog(obs.LOG_ERROR, "Invalid JSON: " + userConfigPath) raise except OSError: obslog(obs.LOG_ERROR, "Unable to open " + userConfigPath) raise populate_browser_source_file(userConfigPath) else: populate_browser_source_file(None) if image_exists('browsersource:latest'): obslog(obs.LOG_INFO, "browser-source image found") obslog(obs.LOG_INFO, "launching browser-source container") run = start_browser_source_container() obslog(obs.LOG_INFO, "rnstdout: " + run[0] + "; runstderr: " + run[1]) else: build = build_browser_source_image() obslog(obs.LOG_INFO, "buildstdout: " + build[0] + "; buildstderr: " + build[1]) wait_limit = 10 while True: if image_exists('browsersource:latest'): obslog(obs.LOG_INFO, "browser-source image built") obslog(obs.LOG_INFO, "launching browser-source container") run = start_browser_source_container() obslog(obs.LOG_INFO, "runstdout: " + run[0] + "; runstderr: " + run[1]) break else: obslog(obs.LOG_INFO, "browser-source image not found") time.sleep(2) wait_limit -= 1 if wait_limit == 0: obslog(obs.LOG_ERROR, "unable to start browser-source container") #TODO create browser source, if desired obslog(obs.LOG_INFO, "exiting deploy_browser_source_server")
def script_update(settings): global interval global interval_bak obs.timer_remove(decrease_interval) if obs.obs_data_get_bool(settings, "enabled"): interval = obs.obs_data_get_int(settings, "interval") - 1 interval_bak = interval print("activated [" + str(interval + 1) + "min]") if interval > 0: obs.timer_add(decrease_interval, 1000 * 60) else: print("deactivated")