From c8e3ee494cc5ca73f54d5ae24bbf03fc3e42d15d Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Sun, 23 Oct 2016 22:20:08 +0100 Subject: 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 --- DOCS/man/osc.rst | 4 ++++ player/lua/osc.lua | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index ce6471d014..f4e4b5b670 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -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. + diff --git a/player/lua/osc.lua b/player/lua/osc.lua index fec1eb07cb..7c88c9ca4c 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -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) -- cgit v1.2.3