Created
January 29, 2020 06:36
-
-
Save gabrielfern/164d84dd092ac6b76f1fc7f5237e1324 to your computer and use it in GitHub Desktop.
mpv - Toggle playlist showing on screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local timer | |
local show_playlist = false | |
function draw_playlist() | |
mp.osd_message('') | |
mp.set_osd_ass(0, 0, '') | |
mp.commandv('script-message', 'osc-playlist') | |
end | |
function toggle_show_playlist() | |
if show_playlist then | |
if timer then | |
timer:kill() | |
end | |
mp.commandv('script-message', 'osc-message', '') | |
else | |
draw_playlist() | |
local duration = mp.get_property('osd-duration') / 1000 | |
timer = mp.add_periodic_timer(duration, draw_playlist) | |
end | |
show_playlist = not show_playlist | |
end | |
function on_update() | |
if show_playlist then | |
draw_playlist() | |
end | |
end | |
if show_playlist then | |
show_playlist = false | |
toggle_show_playlist() | |
end | |
mp.add_key_binding('f3', 'toggle_show_playlist', toggle_show_playlist) | |
mp.observe_property('playlist-pos', 'number', on_update) | |
mp.observe_property('playlist-count', 'number', on_update) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment