-
-
Notifications
You must be signed in to change notification settings - Fork 6
Scripting
Tip
To reduce update frequency, it's recommended to update this property in mp.register_idle(fn).
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP (menu item)
"type" MPV_FORMAT_STRING (supported type: separator, submenu)
"title" MPV_FORMAT_STRING (required if type is not separator)
"cmd" MPV_FORMAT_STRING (optional)
"shortcut" MPV_FORMAT_STRING (optional)
"state" MPV_FORMAT_NODE_ARRAY[MPV_FORMAT_STRING] (supported state: checked, disabled, hidden)
"submenu" MPV_FORMAT_NODE_ARRAY[menu item] (required if type is submenu)
The menu data of the C plugin is stored in this property, updating it will trigger an update of the menu UI.
Note
Be aware that dyn_menu.lua
is conflict with other scripts that also update the user-data/menu/items
property,
you may use the messages below if you only want to update part of the menu.
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"name" MPV_FORMAT_STRING
"spec" MPV_FORMAT_STRING
Custom file type filters used for open dialog, the first one will be selected by default.
Example:
local file_types = {
{ name = 'All Files (*.*)', spec = '*.*' },
{ name = 'Video Files', spec = '*mp4;*.mkv' },
{ name = 'Audio Files', spec = '*.mp3;*.m4a' },
{ name = 'Subtitle Files', spec = '*.srt;*.ass' },
{ name = 'Playlist Files', spec = '*.m3u;*.m3u8' },
}
Default folder for open and save dialog, if there is not a recently used folder value available.
Default file name for save dialog.
Tip
Want a usage example? Check Scripting example in the wiki.
Broadcasted on start, useful for detecting plugin name.
Broadcasted when the menu is about to open.
Broadcasted when the menu is closed.
Retrieves data from the clipboard (text only).
The result is replied via: script-message-to <src> clipboard-get-reply <text>
.
Places data on the clipboard (text only).
Show an open dialog.
The result is replied via: script-message-to <src> dialog-open-reply <path>
.
Show an open dialog that can select multiple files.
The result is replied via: script-message-to <src> dialog-open-multi-reply <path1> <path2> ...
.
Show an open dialog that can select folder only.
The result is replied via: script-message-to <src> dialog-open-folder-reply <path>
.
Show a save dialog.
The result is replied via: script-message-to <src> dialog-save-reply <path>
.
Note
If there're multiple instances of a keyword
in input.conf
, only the last one will take effect for get
/ update
.
Broadcasted when dyn_menu.lua
has initialized itself.
It's recommended to use <client-name>
as target with script-message-to
, it will work when dyn_menu.lua
is renamed.
Get the menu item structure of keyword
.
The result is replied via: script-message-to <src> menu-get-reply <json>
.
{
"keyword": "chapters"
"item": {
"title": "Chapters",
"type": "submenu",
"submenu": []
}
}
If keyword
is not found, the result json will contain an additional error
field, and no item
field.
Update the menu item structure of keyword
with json
.
As a convenience, if you don't want to override menu title and type, omit the corresponding field in json
.