def script_properties():
    global props
    props = obs.obs_properties_create()
    checkbox = obs.obs_properties_add_bool(props, "use_user_config",
                                           "Use Saved Config")
    obs.obs_property_set_modified_callback(checkbox, is_user_config)
    del (checkbox)
    obs.obs_properties_add_path(
        props, "user_config", "Saved Config Path", obs.OBS_PATH_FILE, "*.json",
        os.path.join(os.path.dirname(__file__), 'config'))
    obs.obs_properties_add_editable_list(props, "score_names",
                                         "Scores To Track",
                                         obs.OBS_EDITABLE_LIST_TYPE_STRINGS,
                                         "", "")
    obs.obs_properties_add_int(props, "score_count", "Count per Score", 0, 10,
                               1)
    obs.obs_properties_add_font(props, "font", "Scores Font")
    obs.obs_properties_add_color(props, "fgcolor", "Text Color")
    obs.obs_properties_add_color(props, "bgcolor", "Background Color")
    obs.obs_properties_add_button(props, "deploy",
                                  "Deploy Browser Source Server",
                                  deploy_browser_source_server)
    obs.obs_properties_add_button(props, "remove",
                                  "Remove Browser Source Server",
                                  remove_browser_source_server)
    obslog(obs.LOG_INFO, "properties loaded")

    #TODO checkbox to add to create browser source
    #TODO browser source name
    return props
def script_properties():
    props = obs.obs_properties_create()
    b = obs.obs_properties_add_button(props, "button",
                                      "refresh pressed 0 times",
                                      refresh_pressed)
    obs.obs_property_set_modified_callback(b, callback)
    return props
def script_properties():  # ui
    props = obs.obs_properties_create()
    p = obs.obs_properties_add_list(
        props,
        "source",
        "Text Source",
        obs.OBS_COMBO_TYPE_EDITABLE,
        obs.OBS_COMBO_FORMAT_STRING,
    )
    sources = obs.obs_enum_sources()
    if sources is not None:
        for source in sources:
            source_id = obs.obs_source_get_unversioned_id(source)
            if source_id == "text_gdiplus" or source_id == "text_ft2_source":
                name = obs.obs_source_get_name(source)
                obs.obs_property_list_add_string(p, name, name)

        obs.source_list_release(sources)
    number = obs.obs_properties_add_int(props, "_int", "Number", 1, 100, 1)
    text_value = obs.obs_properties_add_text(props, "_text",
                                             "Additional input:",
                                             obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_visible(text_value, False)
    obs.obs_property_set_modified_callback(number, callback)
    return props
Beispiel #4
0
def script_properties():
    props = obs.obs_properties_create()
    
    rf = obs.obs_properties_add_text(props, "rf", "Recording folder", obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_long_description(rf, "The recording folder in your settings (must be the same). OBS doesn't allow the script to get it")
    
    wf = obs.obs_properties_add_text(props, "wf", "Watch folder", obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_long_description(wf, "The folder where bench outputs. Usually TF2_FOLDER/tf/results")

    # Auto-move completed demos
    cb_b = obs.obs_properties_add_bool(props, "cb", "Auto-move completed demos?")
    obs.obs_property_set_long_description(cb_b, "Enabling will move recorded .dem, .json, & .vdm files to the archive folder directory to avoid double recording")
    obs.obs_property_set_modified_callback(cb_b, cb_pressed)
    
    # Auto restart
    al_b = obs.obs_properties_add_bool(props, "al", "(LINUX ONLY) Auto relaunch TF2 demo recording on crash?")
    obs.obs_property_set_long_description(al_b, "Currently only supports GNU/Linux. Will attempt to auto restart demo recording if TF2 crashes on the next clip")
    obs.obs_property_set_modified_callback(al_b, al_pressed)
    
    df = obs.obs_properties_add_text(props, "df", "Demo folder", obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_long_description(df, "The folder containing your .dem files")
    visible_prop(props, "df", al or cb)

    af = obs.obs_properties_add_text(props, "af", "Archive folder", obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_long_description(af, "The folder to move completed .dem files")
    visible_prop(props, "af", cb)

    obs.obs_properties_add_button(props,"b1","Start", b_start)

    return props
Beispiel #5
0
def script_qualifier_settings(props, rtgg_obs: RacetimeObs):
    lang = gettext.translation("racetime-obs",
                               localedir=os.environ['LOCALEDIR'])
    _ = lang.gettext

    p = obs.obs_properties_add_bool(
        props, "use_qualifier",
        _("Display race results as tournament qualifier?"))
    obs.obs_property_set_modified_callback(p, qualifier_toggled)
    qualifier_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "qualifier_group", _("Qualifier Mode"),
                                 obs.OBS_GROUP_NORMAL, qualifier_group)
    obs.obs_property_set_visible(
        obs.obs_properties_get(props, "qualifier_group"),
        rtgg_obs.qualifier.enabled)
    p = obs.obs_properties_add_int_slider(qualifier_group, "qualifier_cutoff",
                                          _("Use Top X as par time, where X="),
                                          3, 10, 1)
    p = obs.obs_properties_add_list(qualifier_group, "qualifier_par_source",
                                    _("Qualifier Par Time Source"),
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    fill_source_list(p)
    p = obs.obs_properties_add_list(qualifier_group, "qualifier_score_source",
                                    _("Qualifier Score Source"),
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    fill_source_list(p)
Beispiel #6
0
 def _add(self, p, on_changed, clear=True):
     if clear:
         self.__property = [p]
     else:
         self.__property.append(p)
     if self.doc:
         _obs.obs_property_set_long_description(p, self.doc)
     _obs.obs_property_set_visible(p, self.visible)
     _obs.obs_property_set_enabled(p, self.enabled)
     if on_changed:
         _obs.obs_property_set_modified_callback(p, on_changed)
Beispiel #7
0
def script_properties():
    props = obs.obs_properties_create()

    obs.obs_properties_add_button(props, "start-button", "Start OSC",
                                  listen_pressed)
    obs.obs_properties_add_button(props, "stop-button", "Stop OSC",
                                  stop_pressed)

    port_field = obs.obs_properties_add_int(props, "osc-port", "OSC Port",
                                            1001, 99999, 1)
    obs.obs_property_set_modified_callback(port_field, port_field_changed)

    return props
Beispiel #8
0
def script_properties():
    # print('script_properties')

    props = obs.obs_properties_create()

    model_p = obs.obs_properties_add_path(props, 'live2d_model',
                                          'Live2D Model', obs.OBS_PATH_FILE,
                                          'Live2D Model(*.json)', '')

    level_p = obs.obs_properties_add_int(props, 'root_level',
                                         'Server Root Level', 1,
                                         total_levels(LIVE2D_FULL_PATH), 1)

    port_p = obs.obs_properties_add_int(props, 'port', 'Server Port', 1024,
                                        65535, 1)
    ws_port_p = obs.obs_properties_add_int(props, 'ws_port', 'Websocket Port',
                                           1024, 65535, 1)

    info_p = obs.obs_properties_add_text(props, 'info', 'Info',
                                         obs.OBS_TEXT_MULTILINE)
    obs.obs_property_set_enabled(info_p, False)

    obs.obs_properties_add_button(props, 'start', 'Apply Settings',
                                  apply_settings)

    obs.obs_property_set_modified_callback(model_p, prop_modified)
    obs.obs_property_set_modified_callback(level_p, prop_modified)
    obs.obs_property_set_modified_callback(port_p, prop_modified)
    obs.obs_property_set_modified_callback(ws_port_p, prop_modified)

    return props
Beispiel #9
0
def script_coop_settings(props, rtgg_obs: RacetimeObs):
    lang = gettext.translation("racetime-obs",
                               localedir=os.environ['LOCALEDIR'])
    _ = lang.gettext

    p = obs.obs_properties_add_bool(props, "use_coop",
                                    _("Display coop information?"))
    obs.obs_property_set_modified_callback(p, coop_toggled)
    coop_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "coop_group", _("Co-op Mode"),
                                 obs.OBS_GROUP_NORMAL, coop_group)
    obs.obs_property_set_visible(obs.obs_properties_get(props, "coop_group"),
                                 rtgg_obs.coop.enabled)
    p = obs.obs_properties_add_list(coop_group, "coop_partner",
                                    _("Co-op Partner"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    p = obs.obs_properties_add_list(coop_group, "coop_opponent1",
                                    _("Co-op Rival 1"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    p = obs.obs_properties_add_list(coop_group, "coop_opponent2",
                                    _("Co-op Rival 2"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    fill_coop_entrant_lists(props, rtgg_obs)
    p = obs.obs_properties_add_list(coop_group, "coop_our_source",
                                    _("Our Team's Timer"),
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_long_description(p, (
        _("This text source will display your team's timer when you finish.")))
    fill_source_list(p)
    p = obs.obs_properties_add_list(coop_group, "coop_opponent_source",
                                    "Rival Team's Timer",
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_long_description(
        p,
        (_("This text source will be use to display your rival's timer when "
           "they finish")))
    obs.obs_properties_add_color(coop_group, "coop_winner_color",
                                 _("Winner Color:"))
    obs.obs_properties_add_color(coop_group, "coop_loser_color",
                                 _("Loser Color:"))
    obs.obs_properties_add_color(coop_group, "coop_undetermined_color",
                                 _("Winner Undetermined Color"))
    fill_source_list(p)
Beispiel #10
0
def b_stop(props, prop, *arg, **kwargs):
    p = obs.obs_properties_get(props, "b1")
    obs.obs_property_set_description(p, "Start")
    obs.obs_property_set_modified_callback(p, b_start) 
    
    visible_prop(props, "wf", True)
    visible_prop(props, "rf", True)
    visible_prop(props, "cb", True)
    visible_prop(props, "df", True)
    visible_prop(props, "af", True)
    visible_prop(props, "al", True)
    
    global run 
    run = False
    
    return True
Beispiel #11
0
def b_start(props, prop, *arg, **kwargs):
    p = obs.obs_properties_get(props, "b1")
    obs.obs_property_set_description(p, "Stop")
    obs.obs_property_set_modified_callback(p, b_stop) 
    
    visible_prop(props, "wf", False)
    visible_prop(props, "rf", False)
    visible_prop(props, "cb", False)
    visible_prop(props, "df", False)
    visible_prop(props, "af", False)
    visible_prop(props, "al", False)

    global run
    run = True
    t = threading.Thread(target=busy_thread)
    t.start()
    return True
Beispiel #12
0
def script_properties():
    props = obs.obs_properties_create()
    setup_scripting.script_setup(props, new_race_selected,
                                 new_category_selected)

    refresh = obs.obs_properties_add_button(props, "button", _("Refresh"),
                                            lambda *props: None)
    obs.obs_property_set_modified_callback(refresh, refresh_pressed)
    timer_scripting.script_timer_settings(
        props,
        rtgg_obs,
    )
    coop_scripting.script_coop_settings(props, rtgg_obs)
    qualifier_scripting.script_qualifier_settings(props, rtgg_obs)
    media_player_scripting.script_media_player_settings(
        props, rtgg_obs, media_player_toggled)
    ladder_scripting.script_ladder_settings(props)

    return props
Beispiel #13
0
def script_media_player_settings(props, rtgg_obs: RacetimeObs,
                                 media_player_toggled):
    lang = gettext.translation("racetime-obs",
                               localedir=os.environ['LOCALEDIR'])
    _ = lang.gettext

    p = obs.obs_properties_add_bool(props, "use_media_player",
                                    _("Enable sounds?"))
    obs.obs_property_set_modified_callback(p, media_player_toggled)
    media_player_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "media_player_group",
                                 _("Media Player Mode"), obs.OBS_GROUP_NORMAL,
                                 media_player_group)
    obs.obs_property_set_visible(
        obs.obs_properties_get(props, "media_player_group"),
        rtgg_obs.media_player.enabled)
    monitoring_list = obs.obs_properties_add_list(media_player_group,
                                                  "monitoring_type",
                                                  _("Monitoring Type"),
                                                  obs.OBS_COMBO_TYPE_LIST,
                                                  obs.OBS_COMBO_FORMAT_INT)
    obs.obs_property_list_add_int(monitoring_list, _("Listen Only"),
                                  obs.OBS_MONITORING_TYPE_MONITOR_ONLY)
    obs.obs_property_list_add_int(monitoring_list, _("Stream Only"),
                                  obs.OBS_MONITORING_TYPE_NONE)
    obs.obs_property_list_add_int(monitoring_list, _("Listen and Stream"),
                                  obs.OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT)
    p = obs.obs_properties_add_bool(media_player_group, "use_chat_pings",
                                    _("Chat Pings"))
    obs.obs_property_set_long_description(
        p,
        _("Enable this and set choose a sound file to play when a bot posts"
          " or when someone @s you in racetime.gg chat"))
    p = obs.obs_properties_add_path(media_player_group, "chat_ping_sound",
                                    _("Chat media file"), obs.OBS_PATH_FILE,
                                    "Audio Files (*.mp3 *.aac *.wav *.wma)",
                                    None)
    obs.obs_properties_add_path(media_player_group, "first_place_sound",
                                _("First Place Sound"), obs.OBS_PATH_FILE,
                                "Audio Files (*.mp3 *.aac *.wav *.wma)", None)
    obs.obs_property_set_long_description(
        p, _("Sound file to play when you finish first."))
Beispiel #14
0
def script_timer_settings(props, rtgg_obs: RacetimeObs):
    lang = gettext.translation("racetime-obs",
                               localedir=os.environ['LOCALEDIR'])
    _ = lang.gettext

    p = obs.obs_properties_add_bool(props, "use_podium",
                                    _("Use custom color for podium finishes?"))
    obs.obs_property_set_modified_callback(p, podium_toggled)
    podium_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "podium_group", _("Podium Colors"),
                                 obs.OBS_GROUP_NORMAL, podium_group)
    obs.obs_property_set_visible(obs.obs_properties_get(props, "podium_group"),
                                 rtgg_obs.timer.use_podium_colors)
    obs.obs_properties_add_color(podium_group, "pre_color", _("Pre-race:"))
    obs.obs_properties_add_color(podium_group, "racing_color",
                                 _("Still racing:"))
    obs.obs_properties_add_color(podium_group, "first_color", _("1st place:"))
    obs.obs_properties_add_color(podium_group, "second_color", _("2nd place:"))
    obs.obs_properties_add_color(podium_group, "third_color", _("3rd place:"))
    obs.obs_properties_add_color(podium_group, "finished_color",
                                 _("After podium:"))
Beispiel #15
0
def media_trigger_settings(props, rtgg_obs: RacetimeObs, index: int):
    lang = gettext.translation("racetime-obs",
                               localedir=os.environ['LOCALEDIR'])
    _ = lang.gettext

    media_player_group = obs.obs_properties_create()
    name = f"media_trigger_#{index}"
    obs.obs_properties_add_group(props, name,
                                 _("Media Trigger #") + f"{index}",
                                 obs.OBS_GROUP_NORMAL, media_player_group)
    obs.obs_property_set_visible(
        obs.obs_properties_get(props, "media_player_group"),
        rtgg_obs.media_player.enabled)
    obs.obs_properties_add_path(media_player_group, f"media_path_#{index}",
                                _("Sound File"), obs.OBS_PATH_FILE,
                                "Audio Files (*.mp3 *.aac *.wav *.wma)", None)
    p = obs.obs_properties_add_list(media_player_group,
                                    f"trigger_type_#{index}",
                                    _("Type of Trigger"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_list_add_string(p, "", "")
    obs.obs_property_list_add_string(p, _("Chat"), "chat")
    obs.obs_property_list_add_string(p, _("Finish Place"), "finish")
    obs.obs_property_list_add_string(p, _("Timer"), "time")
    obs.obs_property_set_modified_callback(p, media_type_changed)
    p = obs.obs_properties_add_list(media_player_group,
                                    f"monitoring_type_#{index}",
                                    _("Monitoring Type"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_INT)
    obs.obs_property_list_add_int(p, _("Only Listen"),
                                  obs.OBS_MONITORING_TYPE_MONITOR_ONLY)
    obs.obs_property_list_add_int(p, _("Only Stream"),
                                  obs.OBS_MONITORING_TYPE_NONE)
    obs.obs_property_list_add_int(p, _("Listen and Stream"),
                                  obs.OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT)
Beispiel #16
0
def script_ladder_settings(props):
    ladder_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, lp.ladder_group, _("Ladder Settings"),
                                 obs.OBS_GROUP_NORMAL, ladder_group)
    p = obs.obs_properties_add_text(ladder_group, lp.ladder_name,
                                    _("Ladder Name"), obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_modified_callback(p, name_modified)
    obs.obs_properties_add_color(ladder_group, lp.pre_color,
                                 _("Color Pre-Race"))
    obs.obs_properties_add_color(ladder_group, lp.racing_color,
                                 _("Still Racing Color"))
    obs.obs_properties_add_color(ladder_group, lp.winner_color,
                                 _("Winner Color"))
    obs.obs_properties_add_color(ladder_group, lp.loser_color,
                                 _("Loser Color"))
    obs.obs_properties_add_color(ladder_group, lp.ff_color, _("Forfeit Color"))
    p = obs.obs_properties_add_list(ladder_group, lp.stats_source,
                                    _("Ladder Stats Source"),
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    fill_source_list(p)
    obs.obs_properties_add_bool(ladder_group, lp.show_season_name,
                                _("Show Season Name"))
    obs.obs_properties_add_bool(ladder_group, lp.show_mode_name,
                                _("Show Mode Name"))
    obs.obs_properties_add_bool(ladder_group, lp.show_rating, _("Show Rating"))
    obs.obs_properties_add_bool(ladder_group, lp.show_rank, _("Show Rank"))
    obs.obs_properties_add_bool(ladder_group, lp.show_change, _("Show Change"))
    obs.obs_properties_add_bool(ladder_group, lp.show_win_loss_tie,
                                _("Show Win/Loss/Tie Record"))
    p = obs.obs_properties_add_list(ladder_group, lp.ladder_season,
                                    _("Season for Stats"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_modified_callback(p, season_or_mode_changed)
    obs.obs_property_list_add_string(p, _("Lifetime"), "0")
    obs.obs_property_list_add_string(p, _("Current Season"), "-1")
    p = obs.obs_properties_add_list(ladder_group, lp.ladder_mode,
                                    _("Mode for Stats"),
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_modified_callback(p, season_or_mode_changed)
    obs.obs_property_list_add_string(p, _("Global"), "0")
    obs.obs_property_list_add_string(p, _("Current Mode"), "-1")
Beispiel #17
0
def script_properties():
    """
    Called to define user properties associated with the script. These
    properties are used to define how to show settings properties to a user.
    """
    global Animations
    global props
    props = obs.obs_properties_create()
    ######################################################################
    ## Allow user to select which Video source to create an animation for.
    ######################################################################
    p = obs.obs_properties_add_list(props, "source", "Video Source",
                                    obs.OBS_COMBO_TYPE_EDITABLE,
                                    obs.OBS_COMBO_FORMAT_STRING)
    sources = obs.obs_enum_sources()
    if sources is not None:
        for source in sources:
            source_id = obs.obs_source_get_id(source)
            if source_id == "dshow_input":
                name = obs.obs_source_get_name(source)
                obs.obs_property_list_add_string(p, name, name)

        obs.source_list_release(sources)
    ######################################################################

    ######################################################################
    ## Display Server Settings
    ######################################################################
    obs.obs_properties_add_text(props, Server.addressStorage, "Address",
                                obs.OBS_TEXT_DEFAULT)
    obs.obs_properties_add_int(props, Server.portStorage, "Port", 0, 99999, 1)
    ######################################################################

    animationCountProperties = []
    animationCountProperty = obs.obs_properties_add_int(
        props, "animationCount", "Animations (Reload scripts to take effect)",
        0, 25, 1)
    animationCountProperties.append(animationCountProperty)
    obs.obs_property_set_modified_callback(animationCountProperties[0],
                                           properties_set_vis)

    customStartingProperties = []
    variationProperties = []
    setDestinationValuesButtons = []
    movementProperties = []

    # For each command, do the following:
    for i in range(animationCount):
        index = i
        obs.obs_properties_add_text(
            props, "Blocker" + str(i),
            "------------------Animation " + str(i) + "-------------------",
            obs.OBS_TEXT_DEFAULT)

        property_list = obs.obs_properties_add_list(
            props, Animations[i].variationTypeStorage, Variation.Type,
            obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_INT)
        obs.obs_property_list_add_int(property_list, Variation.Position,
                                      VARIATION_POSITION)
        obs.obs_property_list_add_int(property_list, Variation.Size,
                                      VARIATION_SIZE)
        obs.obs_property_list_add_int(property_list, Variation.PositionAndSize,
                                      VARIATION_POSITION | VARIATION_SIZE)
        obs.obs_property_list_add_int(property_list, Variation.PositionFree,
                                      VARIATION_POSITION_FREE)
        obs.obs_property_list_add_int(property_list, Variation.PositionFreeAll,
                                      VARIATION_POSITION_FREE_ALL)
        obs.obs_property_list_add_int(property_list, Variation.SizeFree,
                                      VARIATION_SIZE_FREE)
        variationProperties.append(property_list)

        customStartingProperties.append(
            obs.obs_properties_add_bool(
                props, Animations[i].customStartingSettingStorage,
                "Custom Starting Setting"))

        obs.obs_property_set_modified_callback(customStartingProperties[index],
                                               properties_set_vis)
        obs.obs_property_set_modified_callback(variationProperties[index],
                                               properties_set_vis)
        # obs.obs_property_set_modified_callback(customStartingProperties[index], properties_set_vis)

        setDestinationValuesButtons.append(
            obs.obs_properties_add_button(
                props, Animations[i].setDestinationStorage,
                "Populate Destination Position And Size (Reload Script To See Change)",
                SetDestinationPositionAndSize))

        obs.obs_properties_add_int(props, Animations[i].startingXStorage,
                                   "Starting X", -8192, 8192, 1)
        obs.obs_properties_add_int(props, Animations[i].startingYStorage,
                                   "Starting Y", -8192, 8192, 1)
        obs.obs_properties_add_int(props, Animations[i].destinationXStorage,
                                   "Destination X", -8192, 8192, 1)
        obs.obs_properties_add_int(props, Animations[i].destinationYStorage,
                                   "Destination Y", -8192, 8192, 1)

        # Handle movement type:
        movement_property_list = obs.obs_properties_add_list(
            props, Animations[i].movementTypeStorage, Movement.Type,
            obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_INT)
        obs.obs_property_list_add_int(movement_property_list, Movement.Speed,
                                      MOVEMENT_SPEED)
        obs.obs_property_list_add_int(movement_property_list,
                                      Movement.Duration, MOVEMENT_DURATION)
        obs.obs_property_list_add_int(movement_property_list,
                                      Movement.Quickest, MOVEMENT_QUICKEST)

        obs.obs_properties_add_int(props, Animations[i].durationStorage,
                                   "Duration (seconds)", 0, 8192, 1)
        obs.obs_properties_add_int(props, Animations[i].posSpeedStorage,
                                   "Position Speed (Pixels per second)", 1,
                                   8192, 1)

        movementProperties.append(movement_property_list)

        obs.obs_property_set_modified_callback(movementProperties[index],
                                               properties_set_vis)

        # Handle pos speed direction
        direction_list = obs.obs_properties_add_list(
            props, Animations[i].posDirectionStorage, Direction.Type,
            obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_INT)
        obs.obs_property_list_add_int(direction_list, Direction.Up,
                                      Direction.UP_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Down,
                                      Direction.DOWN_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Left,
                                      Direction.LEFT_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Right,
                                      Direction.RIGHT_INDEX)

        obs.obs_property_list_add_int(direction_list, Direction.Up_Left,
                                      Direction.UP_LEFT_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Up_Right,
                                      Direction.UP_RIGHT_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Down_Left,
                                      Direction.DOWN_LEFT_INDEX)
        obs.obs_property_list_add_int(direction_list, Direction.Down_Right,
                                      Direction.DOWN_RIGHT_INDEX)

        obs.obs_properties_add_int(props, Animations[i].startingWidthStorage,
                                   "Starting Width", -8192, 8192, 1)
        obs.obs_properties_add_int(props, Animations[i].startingHeightStorage,
                                   "Starting Height", -8192, 8192, 1)
        obs.obs_properties_add_int(props,
                                   Animations[i].destinationWidthStorage,
                                   "Destination Width", -8192, 8192, 1)
        obs.obs_properties_add_int(props,
                                   Animations[i].destinationHeightStorage,
                                   "Destination Height", -8192, 8192, 1)

        obs.obs_properties_add_bool(props,
                                    Animations[i].changeSizeInPlaceStorage,
                                    "Change Size In Place")

        obs.obs_properties_add_text(props, Animations[i].commandStorage,
                                    "Command", obs.OBS_TEXT_DEFAULT)
        obs.obs_properties_add_text(props, Animations[i].stopCommandStorage,
                                    "Stop Command", obs.OBS_TEXT_DEFAULT)
        animationProperties_set_vis(props, Animations[i],
                                    Animations[i].variationType,
                                    Animations[i].movementType,
                                    Animations[i].customStartingSetting)
    return props
Beispiel #18
0
def script_properties():
    props = obs.obs_properties_create()
    obs.obs_properties_add_text(
        props, "scripted_text", "Scripted text", obs.OBS_TEXT_MULTILINE
    )
    bool = obs.obs_properties_add_bool(props, "use_file", "Use file(UTF-8)")
    bool2 = obs.obs_properties_add_bool(props, "reload_file", "Auto reload file")

    fp = obs.obs_properties_add_path(
        props, "file_path", "Select file", obs.OBS_PATH_FILE, "*.*", std.path
    )

    obs.obs_property_set_visible(fp, std.use_file)
    obs.obs_property_set_visible(bool2, std.use_file)
    obs.obs_property_set_modified_callback(bool, check_file_use)
    obs.obs_property_set_modified_callback(bool2, check_file_use)
    obs.obs_properties_add_int(
        props, "refresh_rate", "Refresh rate(ms)", 15, 5 * 1000, 1
    )
    obs.obs_properties_add_int(props, "duration", "Duration shown(s)", 1, 3600, 1)

    p = obs.obs_properties_add_list(
        props,
        "source",
        "<h2>Text Source</h2>",
        obs.OBS_COMBO_TYPE_EDITABLE,
        obs.OBS_COMBO_FORMAT_STRING,
    )
    sp = obs.obs_properties_add_list(
        props,
        "playsound",
        "Media Source",
        obs.OBS_COMBO_TYPE_EDITABLE,
        obs.OBS_COMBO_FORMAT_STRING,
    )
    tp = obs.obs_properties_add_list(
        props,
        "text_effect",
        "Text effect",
        obs.OBS_COMBO_TYPE_EDITABLE,
        obs.OBS_COMBO_FORMAT_STRING,
    )

    lp = obs.obs_properties_add_list(
        props,
        "layer",
        "Layer(img,video,gif,etc..)",
        obs.OBS_COMBO_TYPE_EDITABLE,
        obs.OBS_COMBO_FORMAT_STRING,
    )

    obs.obs_property_set_long_description(
        tp, "<h1>Description of current text effect</h1>"
    )

    for i in std.txt_efcts.keys():
        obs.obs_property_list_add_string(tp, i, i)
    obs.obs_property_set_modified_callback(tp, show_tooltip)

    sources = obs.obs_enum_sources()
    if sources is not None:
        for source in sources:
            # exclude Desktop Audio and Mic/Aux by their capabilities
            capability_flags = obs.obs_source_get_output_flags(source)
            if (
                capability_flags & obs.OBS_SOURCE_DO_NOT_SELF_MONITOR
            ) == 0 and capability_flags != (
                obs.OBS_SOURCE_AUDIO | obs.OBS_SOURCE_DO_NOT_DUPLICATE
            ):
                source_id = obs.obs_source_get_unversioned_id(source)
                if source_id == "text_gdiplus" or source_id == "text_ft2_source":
                    name = obs.obs_source_get_name(source)
                    obs.obs_property_list_add_string(p, name, name)
                if source_id == "ffmpeg_source":
                    name = obs.obs_source_get_name(source)
                    obs.obs_property_list_add_string(sp, name, name)
                else:
                    name = obs.obs_source_get_name(source)
                    obs.obs_property_list_add_string(lp, name, name)

        obs.source_list_release(sources)

    scenes = obs.obs_frontend_get_scenes()  # for layered scene source
    for scene in scenes:
        name = obs.obs_source_get_name(scene)
        obs.obs_property_list_add_string(lp, name, name)
    obs.source_list_release(scenes)

    obs.obs_properties_add_button(
        props, "button1", "PREVIEW", lambda *props: std.hotkey_hook()
    )

    obs.obs_properties_add_button(
        props, "button2", "RESET", lambda *props: std.reset_duration()
    )

    return props
def script_properties():
    props = obs.obs_properties_create()

    p = obs.obs_properties_add_bool(props, "manage_streaming",
                                    "Manage Streaming")
    obs.obs_property_set_modified_callback(p, on_property_modified)
    p = obs.obs_properties_add_bool(props, "manage_recording",
                                    "Manage Recording")
    obs.obs_property_set_modified_callback(p, on_property_modified)

    auto_start_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "auto_start_group", "Auto Start",
                                 obs.OBS_GROUP_NORMAL, auto_start_group)

    p = obs.obs_properties_add_list(auto_start_group, "start_scene",
                                    "Start Scene", obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_enabled(p, manage_streaming or manage_recording)
    obs.obs_property_set_modified_callback(p, on_property_modified)
    obs.obs_property_list_add_string(p, "--Disabled--", "")
    scene_names = obs.obs_frontend_get_scene_names()
    if scene_names != None:
        for scene_name in scene_names:
            obs.obs_property_list_add_string(p, scene_name, scene_name)

    schedule_group = obs.obs_properties_create()
    obs.obs_properties_add_group(auto_start_group, "schedule_group",
                                 "Schedule", obs.OBS_GROUP_NORMAL,
                                 schedule_group)

    p = obs.obs_properties_add_list(schedule_group, "weekday", "Day of Week",
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_INT)
    obs.obs_property_set_enabled(p, (manage_streaming or manage_recording)
                                 and start_scene != "")
    for i, day_of_week in enumerate(days_of_week):
        obs.obs_property_list_add_int(p, day_of_week, i)

    p = obs.obs_properties_add_list(schedule_group, "preshow_duration",
                                    "Livestream Start",
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_INT)
    obs.obs_property_set_enabled(p, (manage_streaming or manage_recording)
                                 and start_scene != "")
    obs.obs_property_list_clear(p)
    for i in range(4):
        seconds = i * 60 * 5
        obs.obs_property_list_add_int(
            p,
            time(hour=math.floor((event_start - seconds) / 60 / 60),
                 minute=int(
                     (event_start - seconds) / 60 % 60)).strftime("%I:%M %p"),
            seconds)

    p = obs.obs_properties_add_list(schedule_group, "event_start",
                                    "Event Start", obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_INT)
    obs.obs_property_set_enabled(p, (manage_streaming or manage_recording)
                                 and start_scene != "")
    obs.obs_property_set_modified_callback(p, event_start_list_modified)
    for i in range(288):
        obs.obs_property_list_add_int(
            p,
            time(hour=math.floor(i / 12),
                 minute=(i % 12) * 5).strftime("%I:%M %p"),
            int((i / 12) * 60 * 60))

    text_source_list = obs.obs_properties_add_list(auto_start_group,
                                                   "text_source",
                                                   "Text Source",
                                                   obs.OBS_COMBO_TYPE_LIST,
                                                   obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_enabled(text_source_list,
                                 (manage_streaming or manage_recording)
                                 and start_scene != "")
    obs.obs_property_set_modified_callback(text_source_list,
                                           on_property_modified)
    obs.obs_property_list_add_string(text_source_list, "--Disabled--", "")

    sources = obs.obs_enum_sources()
    if sources != None:
        for source in sources:
            source_id = obs.obs_source_get_unversioned_id(source)
            if source_id == "text_gdiplus" or source_id == "text_ft2_source":
                name = obs.obs_source_get_name(source)
                obs.obs_property_list_add_string(text_source_list, name, name)
    obs.source_list_release(sources)

    p = obs.obs_properties_add_text(auto_start_group, "countdown_final_text",
                                    "Countdown Final Text",
                                    obs.OBS_TEXT_DEFAULT)
    obs.obs_property_set_enabled(p, (manage_streaming or manage_recording)
                                 and text_source != "" and start_scene != "")

    auto_stop_group = obs.obs_properties_create()
    obs.obs_properties_add_group(props, "auto_stop_group", "Auto Stop",
                                 obs.OBS_GROUP_NORMAL, auto_stop_group)

    p = obs.obs_properties_add_list(auto_stop_group, "closing_scene",
                                    "Closing Scene", obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_enabled(p, manage_streaming or manage_recording)
    obs.obs_property_set_modified_callback(p, closing_scene_modified)
    obs.obs_property_list_add_string(p, "--Disabled--", "")
    scene_names = obs.obs_frontend_get_scene_names()
    if scene_names != None:
        for scene_name in scene_names:
            obs.obs_property_list_add_string(p, scene_name, scene_name)

    p = obs.obs_properties_add_int(auto_stop_group, "stop_streaming_delay",
                                   "Streaming Delay", 0, 300, 15)
    obs.obs_property_set_enabled(p, manage_streaming and closing_scene != "")
    p = obs.obs_properties_add_int(auto_stop_group, "stop_recording_delay",
                                   "Recording Delay", 0, 120, 5)
    obs.obs_property_set_enabled(p, manage_recording and closing_scene != "")

    return props
Beispiel #20
0
def script_properties():  # OBS script interface.
    props = obs.obs_properties_create()

    grp = obs.obs_properties_create()
    p = obs.obs_properties_add_bool(grp, 'help', 'Help')
    obs.obs_property_set_enabled(p, False)
    obs.obs_property_set_long_description(
        p,
        '''<p>This script automatically maps Discord video calls into the scene’s layout.</p>
<h3>Discord instructions</h3>
<ol>
  <li>In the voice channel where the call is happening, go to the bottom-right corner and select <em>Pop Out.</em></li>
  <li>In the top-right corner, ensure you’re in <em>Grid</em> mode (no caller appears big while the rest are small).</li>
</ol>

<h3>OBS capture source and scene set-up</h3>
<ol>
  <li>Create a <em>Window Capture</em> source and set it to capture your Discord call.</li>
  <li>Move and crop it until it’s the size and position you want a single caller’s video to be in the scene— don’t pay any attention to which area of the Discord call it shows, as that’s what this script does for you.</li>
  <li>Duplicate it <strong>(always as reference)</strong> and tweak it for every other caller, across scenes, etc.</li>
  <li>Make sure the order of all Discord items in the <em>Sources</em> panel matches across your scenes, with the order in which you want the participants to show up (see next section).</li>
</ol>

<h3>Using this script</h3>
<ol>
  <li>Clicking on <em>Bot invite link</em> will take to a Discord webpage where you can invite your bot to any of your servers with the right permissions, or you can copy the URL and share it with someone who owns another server too.</li>
  <li>Open the dropdown menu below, and pick the voice channel you’re in.</strong></li>
  <li>Tick the <em>Full Screen</li> and <em>Show Non-Video Participants</em> checkboxes according to the state of your Discord call (on Discord, <em>Show Non-Video Participants</em> is located under the three dots button at the top right of the call window).</li>
  <li>Open the next dropdown menu, and pick the source that’s capturing the Discord call. <strong>CAUTION: this will irreversibly modify all items belonging to the source you pick! Moreover, the script knows which items to modify based on their source’s name alone, so please avoid changing your sources’ names to prevent unexpected behaviour.</strong></li>
  <li>If <em>Show Non-Video Participants</em> is off, you can tick <em>Show/hide item right below for audio-only.</em> This requires an item right below each Discord item, which the script will show when the participant has no video, and hide otherwise.</li>
  <li>Pick yourself in the <em>Myself</em> list, so that you appear un-mirrored to the rest of the world while your video is on.</li>
  <li>Choose every participant you want to appear in your scene. Follow the same order you used with your Discord items in the <em>Sources</em> panel.</li>
  <li><strong>If you’re in <em>Studio Mode,</em> click on the gear icon between both views, and make sure <em>Duplicate Scene</em> is OFF!</strong></li>
</ol>''')

    p = obs.obs_properties_add_button(grp, 'bot_invite_link',
                                      'Bot invite link', bot_invite)
    obs.obs_property_set_long_description(
        p,
        '<p>Go to a Discord webpage that lets you invite your bot into any of your servers with the right permissions. You can share this URL with the owner of another server so they invite it for you.</p>'
    )

    p = obs.obs_properties_add_list(grp, 'voice_channel', 'Voice channel',
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_modified_callback(p, populate_participants)
    obs.obs_property_set_long_description(
        p,
        '<p>Discord server and voice/video channel where the call is happening.</p>'
    )
    p = obs.obs_properties_add_button(grp, 'refresh_channels',
                                      'Refresh channels', populate_channels)
    obs.obs_property_set_long_description(
        p,
        '<p>Rebuild the list of channels above. Useful for when you’ve just invited the bot to a server, or a new channel has been created in one of the servers it’s invited to. Don’t worry— it won’t reset your choice, unless it’s no longer available.</p>'
    )

    p = obs.obs_properties_add_bool(grp, 'full_screen', 'Full-screen')
    obs.obs_property_set_long_description(
        p,
        '<p>Whether the Discord call window is in <em>Full Screen</em> mode</p>'
    )
    p = obs.obs_properties_add_bool(grp, 'show_nonvideo_participants',
                                    'Show Non-Video Participants')
    obs.obs_property_set_modified_callback(
        p, show_nonvideo_participants_callback)
    obs.obs_property_set_long_description(
        p,
        '<p>Whether the Discord call window has <em>Show Non-video Participants</em> on (under the three dots button at the top right corner)</p>'
    )

    p = obs.obs_properties_add_list(grp, 'discord_source', 'Discord source',
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_long_description(
        p,
        '<p>Source that is capturing the Discord call. <strong>CAUTION: this will irreversibly modify all items belonging to the source you pick!</strong></p>'
    )
    p = obs.obs_properties_add_button(grp, 'refresh_sources',
                                      'Refresh sources', populate_sources)
    obs.obs_property_set_long_description(
        p,
        '<p>Rebuild the list of sources above. Useful for when you’ve made major changes to your scenes. This won’t reset your choice, unless it’s no longer available.</p>'
    )
    p = obs.obs_properties_add_bool(
        grp, 'item_right_below', 'Show/hide item right below for audio-only')
    obs.obs_property_set_long_description(
        p,
        '<p>Requires an item right below each Discord item, which the script will show when the participant has no video, and hide otherwise</p>'
    )

    obs.obs_properties_add_group(props, 'general', 'General',
                                 obs.OBS_GROUP_NORMAL, grp)

    grp = obs.obs_properties_create()
    p = obs.obs_properties_add_list(grp, 'myself', 'Myself',
                                    obs.OBS_COMBO_TYPE_LIST,
                                    obs.OBS_COMBO_FORMAT_STRING)
    obs.obs_property_set_long_description(
        p, '<p>Participant whose video should be un-mirrored (yourself).</p>')
    p = obs.obs_properties_add_button(grp, 'refresh_names', 'Refresh names',
                                      populate_participants)
    obs.obs_property_set_long_description(
        p,
        '<p>Rebuild the participant lists. Useful when there have been nickname changes, or someone has joined the server. Don’t worry— it won’t reset each choice, unless a selected participant left the server.</p>'
    )
    for i in range(SLOTS):
        p = obs.obs_properties_add_list(grp, f'participant{i}', None,
                                        obs.OBS_COMBO_TYPE_LIST,
                                        obs.OBS_COMBO_FORMAT_STRING)
        obs.obs_property_set_long_description(
            p, '<p>Participant to appear at the ' + ordinal(i + 1) +
            ' capture item from the top of the scene</p>')
    obs.obs_properties_add_group(props, 'participant_layout',
                                 'Participant layout', obs.OBS_GROUP_NORMAL,
                                 grp)

    populate_sources(props)
    while not client.is_ready():
        time.sleep(0.1)
    populate_channels(props)
    populate_participants(props)

    obs.obs_properties_apply_settings(props, settings)
    return props