reformat menu

This commit is contained in:
Ren Tatsumoto 2020-09-28 13:40:07 +03:00
parent 13c0d7e04f
commit 2e96a48723

View file

@ -163,6 +163,7 @@ encoder.create_audioclip = function(clip_filename)
end end
encoder.create_clip = function(clip_type) encoder.create_clip = function(clip_type)
menu.close();
if clip_type == nil then if clip_type == nil then
return return
end end
@ -191,6 +192,7 @@ encoder.create_clip = function(clip_type)
else else
mp.osd_message(string.format("Clip saved to %s.", location), 2) mp.osd_message(string.format("Clip saved to %s.", location), 2)
end end
menu.timings:reset()
end end
------------------------------------------------------------ ------------------------------------------------------------
@ -210,8 +212,8 @@ menu.keybinds = {
{ key = 'e', fn = function() menu.set_time('end') end }, { key = 'e', fn = function() menu.set_time('end') end },
{ key = 'S', fn = function() menu.set_time_sub('start') end }, { key = 'S', fn = function() menu.set_time_sub('start') end },
{ key = 'E', fn = function() menu.set_time_sub('end') end }, { key = 'E', fn = function() menu.set_time_sub('end') end },
{ key = 'c', fn = function() menu.close(); encoder.create_clip('video'); menu.timings:reset() end }, { key = 'c', fn = function() encoder.create_clip('video') end },
{ key = 'a', fn = function() menu.close(); encoder.create_clip('audio'); menu.timings:reset() end }, { key = 'a', fn = function() encoder.create_clip('audio') end },
{ key = 'o', fn = function() mp.commandv('run', 'xdg-open', 'https://streamable.com/') end }, { key = 'o', fn = function() mp.commandv('run', 'xdg-open', 'https://streamable.com/') end },
{ key = 'ESC', fn = function() menu.close() end }, { key = 'ESC', fn = function() menu.close() end },
} }
@ -248,10 +250,12 @@ menu.update = function()
osd:tab():bold('S: '):append('Set start time based on subtitles'):newline() osd:tab():bold('S: '):append('Set start time based on subtitles'):newline()
osd:tab():bold('E: '):append('Set end time based on subtitles'):newline() osd:tab():bold('E: '):append('Set end time based on subtitles'):newline()
osd:newline() osd:newline()
osd:tab():bold('c: '):append('Create video clip'):newline()
osd:tab():bold('a: '):append('Create audio clip'):newline()
osd:tab():bold('o: '):append('Open `streamable.com`'):newline() osd:tab():bold('o: '):append('Open `streamable.com`'):newline()
osd:tab():bold('ESC: '):append('Close'):newline() osd:tab():bold('ESC: '):append('Close'):newline()
osd:newline()
osd:bold('Create clip:'):newline()
osd:tab():bold('c: '):append('video clip'):newline()
osd:tab():bold('a: '):append('audio clip'):newline()
menu.overlay_draw(osd:get_text()) menu.overlay_draw(osd:get_text())
end end