Beispiel #1
0
def script_properties():
    props = obs.obs_properties_create()

    # There seems to be an issue with the SWIG interop that prevents us from
    # enumerating over the scenes. As a result, the user will have to type in the scene name.
    # However, for multiple scene selection, that is probably the only possible way.
    obs.obs_properties_add_text(props, scenes_property, "Scene(s)",
                                obs.OBS_TEXT_MULTILINE)

    comports_list = obs.obs_properties_add_list(props, comport_property,
                                                "COM Port",
                                                obs.OBS_COMBO_TYPE_LIST,
                                                obs.OBS_COMBO_FORMAT_STRING)
    [
        obs.obs_property_list_add_string(comports_list, str(comport),
                                         comport.device)
        for comport in discover_comports()
    ]

    obs.obs_properties_add_text(props, on_value_property, "Value when live",
                                obs.OBS_TEXT_DEFAULT)
    obs.obs_properties_add_text(props, off_value_property,
                                "Value when not live", obs.OBS_TEXT_DEFAULT)

    obs.obs_properties_add_bool(props, debug_value_property, "Debug")

    obs.obs_frontend_add_event_callback(frontend_event_callback)

    return props
Beispiel #2
0
def set_current_scene(scene):
	obs.obs_frontend_remove_event_callback(on_event)
	if obs.obs_frontend_preview_program_mode_active():
		obs.obs_frontend_set_current_preview_scene(scene)
	else:
		obs.obs_frontend_set_current_scene(scene)
	obs.obs_frontend_add_event_callback(on_event)
Beispiel #3
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)
Beispiel #4
0
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))
Beispiel #5
0
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_)
Beispiel #6
0
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)
Beispiel #7
0
def script_load(settings):
	global settngs
	settngs = settings
	print('toggle script loaded')
	scenes = obs.obs_frontend_get_scenes()
	if len(scenes) > 0:
		global loaded
		loaded = True
		_register_hot_keys(settings)
	obs.source_list_release(scenes)
	obs.obs_frontend_add_event_callback(on_event)
Beispiel #8
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
def check_start():
    t = diff_time().total_seconds()
    if t > preshow_duration and not (obs.obs_frontend_streaming_active()
                                     or obs.obs_frontend_recording_active()):
        set_text_source("Waiting" +
                        ("".join(["."
                                  for i in range(((int(t) % 4) - 3) * -1)])))
    elif t <= preshow_duration:
        obs.obs_frontend_add_event_callback(on_event)
        if manage_streaming:
            obs.obs_frontend_streaming_start()
        if manage_recording:
            obs.obs_frontend_recording_start()
        obs.timer_add(update_countdown, 1000)
        obs.timer_remove(check_start)
Beispiel #10
0
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_load(settings):
    obs.obs_frontend_add_event_callback(on_event)
def script_load(settings):
    print("OBS mute scene switch script loaded.")
    set_audio_sources()
    obs.obs_frontend_add_event_callback(on_event)
Beispiel #13
0
def script_description():
    return "OBS RPC for Discord!"


def obs_event(event):
    if event == obs.OBS_FRONTEND_EVENT_EXIT:
        rpc.clear()
        rpc.close()
        return
    key = None
    message = "Idling"
    scene = obs.obs_frontend_get_current_scene()
    if obs.obs_frontend_streaming_active():
        key = 'play_button'
        message = "Streaming"
    if obs.obs_frontend_recording_active():
        key = 'record'
        message = "Recording"
    if obs.obs_frontend_recording_active(
    ) and obs.obs_frontend_streaming_active():
        message = "Streaming and Recording"
    rpc.update(state=message,
               start=None
               if message == "Idling" else datetime.datetime.now().timestamp(),
               small_image=key,
               large_image='obs_studio')


obs.obs_frontend_add_event_callback(obs_event)
Beispiel #14
0
def script_load(settings):
    print('rec-nanoleaf script loaded')
    obs.obs_frontend_add_event_callback(on_event)
def script_load(settings):
    """
    Just prints a message indicating that the script was loaded successfully.
    """
    print("MQTT script loaded.")
    obs.obs_frontend_add_event_callback(on_frontend_event)