1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

osc: add script message handlers for chapter/track/playlists

These can be used in input.conf for pretty formatting of lists as
with shift+clicking the OSC buttons.

Ex:
z   script-message osc-playlist
Z   script-message osc-chapterlist
x   script-message osc-tracklist
This commit is contained in:
Ricardo Constantino 2016-10-23 22:20:08 +01:00
parent 363982c774
commit c8e3ee494c
No known key found for this signature in database
GPG Key ID: EFD16019AE4FF531
2 changed files with 17 additions and 0 deletions

View File

@ -260,3 +260,7 @@ to set auto mode (the default) with ``b``::
a script-message osc-visibility never
b script-message osc-visibility auto
``osc-playlist``, ``osc-chapterlist``, ``osc-tracklist``
Shows a limited view of the respective type of list using the OSC. First
argument is duration in seconds.

View File

@ -2127,6 +2127,19 @@ mp.register_event("tracks-changed", request_init)
mp.observe_property("playlist", nil, request_init)
mp.register_script_message("osc-message", show_message)
mp.register_script_message("osc-chapterlist", function(dur)
show_message(get_chapterlist(), dur)
end)
mp.register_script_message("osc-playlist", function(dur)
show_message(get_playlist(), dur)
end)
mp.register_script_message("osc-tracklist", function(dur)
local msg = {}
for k,v in pairs(nicetypes) do
table.insert(msg, get_tracklist(k))
end
show_message(table.concat(msg, '\n\n'), dur)
end)
mp.observe_property("fullscreen", "bool",
function(name, val)