Skip to content

Instantly share code, notes, and snippets.

@gabrielfern
Created January 29, 2020 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielfern/164d84dd092ac6b76f1fc7f5237e1324 to your computer and use it in GitHub Desktop.
Save gabrielfern/164d84dd092ac6b76f1fc7f5237e1324 to your computer and use it in GitHub Desktop.
mpv - Toggle playlist showing on screen
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