示例#1
0
    def addConfig(cls, props):
        addMidiTypeProp(props, cls.Keys.cmdType, "Transition to Scene midi type")
        addNoteProp(props, cls.Keys.transitionFirst, "First Transition to Scene Midi Note/Address")
        transition_prop = obs.obs_properties_add_int(props, cls.Keys.duration, "Base transition time (MS) -- multiplied by Midi Value/100", 0, 5000, 1)
        obs.obs_property_set_long_description(transition_prop, """This value will be multiplied by the MIDI value/100.
e.g. if the MIDI note comes with a value/velocity of 100, then the base transition time will be used.
If the note comes with a value/velocity of 50, then then the transition will take half the base transition time.
If the note comes with a value/velocity of 0, then then there will be no transition time.""")
示例#2
0
文件: props.py 项目: zooba/obs-python
 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)
示例#3
0
def show_tooltip(props, prop, settings):
    p = obs.obs_properties_get(props, "text_effect")
    docs = getattr(std, std.effect + "_effect", "default")
    if docs == "default":
        selection = "[error]: there is no such effect".upper()
        color = "red"
    else:
        selection = docs.__doc__
        color = "green"
    styled_docs = f'<h1 style="color:{color};">{selection}</h1>'
    obs.obs_property_set_long_description(p, styled_docs)
    return True
示例#4
0
def script_properties():
	logger.debug('script_properties')
	props = obs.obs_properties_create()
	enabled = obs.obs_properties_add_bool(props, "enabled", "Enabled")
	obs.obs_property_set_long_description(enabled, "Whether to save the file when recording or not.")

	long_default_fps_description = "Use this option to achieve higher accuracy than every video frame."

	default_fps = obs.obs_properties_add_bool(props, "use_default_fps", "Use video's FPS to capture cursor")
	obs.obs_property_set_long_description(default_fps, long_default_fps_description)

	custom_fps = obs.obs_properties_add_int_slider(props, "custom_fps", "Custom FPS", 1, 200, 1)
	obs.obs_property_set_long_description(custom_fps, long_default_fps_description)

	install_modules = obs.obs_properties_add_button(
		props,
		"install_modules",
		"Install Python modules",
		install_modules_button_click
	)

	obs.obs_property_set_long_description(
		install_modules,
		"Installs pip, pyautogui and keyboard Python modules in your specified Python interpreter."
	)

	return props
示例#5
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)
示例#6
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."))
示例#7
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
示例#8
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
示例#9
0
文件: discrop.py 项目: UnaiM/discrop
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