mpv-osc-tethys icon indicating copy to clipboard operation
mpv-osc-tethys copied to clipboard

read hover animations from input.conf

Open phyzhenli opened this issue 2 years ago • 8 comments

Hi,

I modify some values of hotkeys in input.conf. Is there a way to read the value from the file and update hover animations?

Thanks

phyzhenli avatar May 21 '22 16:05 phyzhenli

Ctrl+F to search for setButtonTooltip to edit the tooltips.

https://github.com/Zren/mpv-osc-tethys/blob/master/osc_tethys.lua#L3475

As for osc_tethys.lua dynamically parsing the shortcut keys and using them in the tooltips, I'd have to look into it.

  • https://github.com/mpv-player/mpv/blob/master/etc/input.conf
  • https://github.com/mpv-player/mpv/search?q=input.conf
  • https://github.com/mpv-player/mpv/blob/f9fd50c6546f2fa510251267d6423d3f342ca115/player/lua/defaults.lua#L138

Zren avatar May 21 '22 20:05 Zren

Ah, there's a list of keybinding in mpv's stats.lua to use as an example.

  • https://mpv.io/manual/master/#stats
  • https://github.com/mpv-player/mpv/blob/master/player/lua/stats.lua#L433
  • https://mpv.io/manual/master/#command-interface-input-bindings

Zren avatar May 21 '22 23:05 Zren

To log all the bindings:

local bindings = mp.get_property_native("input-bindings", {})
for _, bind in pairs(bindings) do
    jsonstr, err = utils.format_json(bind)
    msg.warn(jsonstr)
end

Here's a few relevant bindings for a couple tooltips.

// Pause
{"comment":"toggle pause/playback mode","priority":0,"key":"MBTN_RIGHT","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"p","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"SPACE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAY","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAYPAUSE","cmd":"cycle pause","section":"default","is_weak":true}

// Seek
{"comment":"seek 10 seconds forward","priority":0,"key":"WHEEL_UP","cmd":"seek 10","section":"default","is_weak":true} 
{"comment":"seek 10 seconds backward","priority":0,"key":"WHEEL_DOWN","cmd":"seek -10","section":"default","is_weak":true} 
{"comment":"seek 5 seconds forward","priority":0,"key":"RIGHT","cmd":"seek  5","section":"default","is_weak":true} 
{"comment":"seek 5 seconds backward","priority":0,"key":"LEFT","cmd":"seek -5","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"UP","cmd":"seek  60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"DOWN","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second forward","priority":0,"key":"Shift+RIGHT","cmd":"no-osd seek  1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second backward","priority":0,"key":"Shift+LEFT","cmd":"no-osd seek -1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds forward","priority":0,"key":"Shift+UP","cmd":"no-osd seek  5 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds backward","priority":0,"key":"Shift+DOWN","cmd":"no-osd seek -5 exact","section":"default","is_weak":true} 
{"comment":"seek 10 minutes forward","priority":0,"key":"Shift+PGUP","cmd":"seek 600","section":"default","is_weak":true} 
{"comment":"seek 10 minutes backward","priority":0,"key":"Shift+PGDWN","cmd":"seek -600","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"FORWARD","cmd":"seek 60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"REWIND","cmd":"seek -60","section":"default","is_weak":true}  
// Seek (added by ~/.config/mpv/input.conf) at priority=5
{"comment":"forward","priority":5,"key":"RIGHT","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"LEFT","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"comment":"forward","priority":5,"key":"WHEEL_UP","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"WHEEL_DOWN","cmd":"seek -5 exact","section":"default","is_weak":false} 

Here's the full list.

{"comment":"don't do anything","priority":0,"key":"MBTN_LEFT","cmd":"ignore","section":"default","is_weak":true} 
{"comment":"toggle fullscreen","priority":0,"key":"MBTN_LEFT_DBL","cmd":"cycle fullscreen","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"MBTN_RIGHT","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"MBTN_BACK","cmd":"playlist-prev","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"MBTN_FORWARD","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"seek 10 seconds forward","priority":0,"key":"WHEEL_UP","cmd":"seek 10","section":"default","is_weak":true} 
{"comment":"seek 10 seconds backward","priority":0,"key":"WHEEL_DOWN","cmd":"seek -10","section":"default","is_weak":true} 
{"key":"WHEEL_LEFT","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"WHEEL_RIGHT","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"comment":"seek 5 seconds forward","priority":0,"key":"RIGHT","cmd":"seek  5","section":"default","is_weak":true} 
{"comment":"seek 5 seconds backward","priority":0,"key":"LEFT","cmd":"seek -5","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"UP","cmd":"seek  60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"DOWN","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second forward","priority":0,"key":"Shift+RIGHT","cmd":"no-osd seek  1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second backward","priority":0,"key":"Shift+LEFT","cmd":"no-osd seek -1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds forward","priority":0,"key":"Shift+UP","cmd":"no-osd seek  5 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds backward","priority":0,"key":"Shift+DOWN","cmd":"no-osd seek -5 exact","section":"default","is_weak":true} 
{"comment":"seek to the previous subtitle","priority":0,"key":"Ctrl+LEFT","cmd":"no-osd sub-seek -1","section":"default","is_weak":true} 
{"comment":"seek to the next subtitle","priority":0,"key":"Ctrl+RIGHT","cmd":"no-osd sub-seek  1","section":"default","is_weak":true} 
{"comment":"change subtitle timing such that the previous subtitle is displayed","priority":0,"key":"Shift+Ctrl+LEFT","cmd":"sub-step -1","section":"default","is_weak":true} 
{"comment":"change subtitle timing such that the next subtitle is displayed","priority":0,"key":"Shift+Ctrl+RIGHT","cmd":"sub-step 1","section":"default","is_weak":true} 
{"comment":"move the video right","priority":0,"key":"Alt+LEFT","cmd":"add video-pan-x  0.1","section":"default","is_weak":true} 
{"comment":"move the video left","priority":0,"key":"Alt+RIGHT","cmd":"add video-pan-x -0.1","section":"default","is_weak":true} 
{"comment":"move the video down","priority":0,"key":"Alt+UP","cmd":"add video-pan-y  0.1","section":"default","is_weak":true} 
{"comment":"move the video up","priority":0,"key":"Alt+DOWN","cmd":"add video-pan-y -0.1","section":"default","is_weak":true} 
{"comment":"zoom in","priority":0,"key":"Alt++","cmd":"add video-zoom   0.1","section":"default","is_weak":true} 
{"comment":"zoom out","priority":0,"key":"Alt+-","cmd":"add video-zoom  -0.1","section":"default","is_weak":true} 
{"comment":"reset zoom and pan settings","priority":0,"key":"Alt+BS","cmd":"set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0","section":"default","is_weak":true} 
{"comment":"seek to the next chapter","priority":0,"key":"PGUP","cmd":"add chapter 1","section":"default","is_weak":true} 
{"comment":"seek to the previous chapter","priority":0,"key":"PGDWN","cmd":"add chapter -1","section":"default","is_weak":true} 
{"comment":"seek 10 minutes forward","priority":0,"key":"Shift+PGUP","cmd":"seek 600","section":"default","is_weak":true} 
{"comment":"seek 10 minutes backward","priority":0,"key":"Shift+PGDWN","cmd":"seek -600","section":"default","is_weak":true} 
{"comment":"decrease the playback speed","priority":0,"key":"[","cmd":"multiply speed 1/1.1","section":"default","is_weak":true} 
{"comment":"increase the playback speed","priority":0,"key":"]","cmd":"multiply speed 1.1","section":"default","is_weak":true} 
{"comment":"halve the playback speed","priority":0,"key":"{","cmd":"multiply speed 0.5","section":"default","is_weak":true} 
{"comment":"double the playback speed","priority":0,"key":"}","cmd":"multiply speed 2.0","section":"default","is_weak":true} 
{"comment":"reset the speed to normal","priority":0,"key":"BS","cmd":"set speed 1.0","section":"default","is_weak":true} 
{"comment":"undo the previous (or marked) seek","priority":0,"key":"Shift+BS","cmd":"revert-seek","section":"default","is_weak":true} 
{"comment":"mark the position for revert-seek","priority":0,"key":"Shift+Ctrl+BS","cmd":"revert-seek mark","section":"default","is_weak":true} 
{"key":"q","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"exit and remember the playback position","priority":0,"key":"Q","cmd":"quit-watch-later","section":"default","is_weak":true} 
{"comment":"leave fullscreen","priority":0,"key":"ESC","cmd":"set fullscreen no","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"p","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"advance one frame and pause","priority":0,"key":".","cmd":"frame-step","section":"default","is_weak":true} 
{"comment":"go back by one frame and pause","priority":0,"key":",","cmd":"frame-back-step","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"SPACE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":">","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"ENTER","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"<","cmd":"playlist-prev","section":"default","is_weak":true} 
{"comment":"toggle displaying the OSD on user interaction or always","priority":0,"key":"O","cmd":"no-osd cycle-values osd-level 3 1","section":"default","is_weak":true} 
{"comment":"show playback progress","priority":0,"key":"o","cmd":"show-progress","section":"default","is_weak":true} 
{"comment":"show playback progress","priority":0,"key":"P","cmd":"show-progress","section":"default","is_weak":true} 
{"comment":"display information and statistics","priority":0,"key":"i","cmd":"script-binding stats/display-stats","section":"default","is_weak":true} 
{"comment":"toggle displaying information and statistics","priority":0,"key":"I","cmd":"script-binding stats/display-stats-toggle","section":"default","is_weak":true} 
{"comment":"open the console","priority":0,"key":"`","cmd":"script-binding console/enable","section":"default","is_weak":true} 
{"comment":"shift subtitles 100 ms earlier","priority":0,"key":"z","cmd":"add sub-delay -0.1","section":"default","is_weak":true} 
{"comment":"delay subtitles by 100 ms","priority":0,"key":"Z","cmd":"add sub-delay +0.1","section":"default","is_weak":true} 
{"comment":"delay subtitles by 100 ms","priority":0,"key":"x","cmd":"add sub-delay +0.1","section":"default","is_weak":true} 
{"comment":"change audio/video sync by delaying the audio","priority":0,"key":"Ctrl++","cmd":"add audio-delay 0.100","section":"default","is_weak":true} 
{"comment":"change audio/video sync by shifting the audio earlier","priority":0,"key":"Ctrl+-","cmd":"add audio-delay -0.100","section":"default","is_weak":true} 
{"comment":"increase the subtitle font size","priority":0,"key":"G","cmd":"add sub-scale +0.1","section":"default","is_weak":true} 
{"comment":"decrease the subtitle font size","priority":0,"key":"F","cmd":"add sub-scale -0.1","section":"default","is_weak":true} 
{"key":"9","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"/","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"0","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"key":"*","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"comment":"toggle mute","priority":0,"key":"m","cmd":"cycle mute","section":"default","is_weak":true} 
{"key":"1","priority":0,"cmd":"add contrast -1","section":"default","is_weak":true} 
{"key":"2","priority":0,"cmd":"add contrast 1","section":"default","is_weak":true} 
{"key":"3","priority":0,"cmd":"add brightness -1","section":"default","is_weak":true} 
{"key":"4","priority":0,"cmd":"add brightness 1","section":"default","is_weak":true} 
{"key":"5","priority":0,"cmd":"add gamma -1","section":"default","is_weak":true} 
{"key":"6","priority":0,"cmd":"add gamma 1","section":"default","is_weak":true} 
{"key":"7","priority":0,"cmd":"add saturation -1","section":"default","is_weak":true} 
{"key":"8","priority":0,"cmd":"add saturation 1","section":"default","is_weak":true} 
{"comment":"halve the window size","priority":0,"key":"Alt+0","cmd":"set current-window-scale 0.5","section":"default","is_weak":true} 
{"comment":"reset the window size","priority":0,"key":"Alt+1","cmd":"set current-window-scale 1.0","section":"default","is_weak":true} 
{"comment":"double the window size","priority":0,"key":"Alt+2","cmd":"set current-window-scale 2.0","section":"default","is_weak":true} 
{"comment":"toggle the deinterlacing filter","priority":0,"key":"d","cmd":"cycle deinterlace","section":"default","is_weak":true} 
{"comment":"move subtitles up","priority":0,"key":"r","cmd":"add sub-pos -1","section":"default","is_weak":true} 
{"comment":"move subtitles down","priority":0,"key":"R","cmd":"add sub-pos +1","section":"default","is_weak":true} 
{"comment":"move subtitles down","priority":0,"key":"t","cmd":"add sub-pos +1","section":"default","is_weak":true} 
{"comment":"hide or show the subtitles","priority":0,"key":"v","cmd":"cycle sub-visibility","section":"default","is_weak":true} 
{"comment":"hide or show the secondary subtitles","priority":0,"key":"Alt+v","cmd":"cycle secondary-sub-visibility","section":"default","is_weak":true} 
{"comment":"toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer","priority":0,"key":"V","cmd":"cycle sub-ass-vsfilter-aspect-compat","section":"default","is_weak":true} 
{"comment":"toggle overriding SSA/ASS subtitle styles with the normal styles","priority":0,"key":"u","cmd":"cycle-values sub-ass-override \"force\" \"no\"","section":"default","is_weak":true} 
{"comment":"switch subtitle track","priority":0,"key":"j","cmd":"cycle sub","section":"default","is_weak":true} 
{"comment":"switch subtitle track backwards","priority":0,"key":"J","cmd":"cycle sub down","section":"default","is_weak":true} 
{"comment":"switch audio track","priority":0,"key":"SHARP","cmd":"cycle audio","section":"default","is_weak":true} 
{"comment":"switch video track","priority":0,"key":"_","cmd":"cycle video","section":"default","is_weak":true} 
{"comment":"toggle placing the video on top of other windows","priority":0,"key":"T","cmd":"cycle ontop","section":"default","is_weak":true} 
{"comment":"toggle fullscreen","priority":0,"key":"f","cmd":"cycle fullscreen","section":"default","is_weak":true} 
{"comment":"take a screenshot of the video in its original resolution with subtitles","priority":0,"key":"s","cmd":"screenshot","section":"default","is_weak":true} 
{"comment":"take a screenshot of the video in its original resolution without subtitles","priority":0,"key":"S","cmd":"screenshot video","section":"default","is_weak":true} 
{"comment":"take a screenshot of the window with OSD and subtitles","priority":0,"key":"Ctrl+s","cmd":"screenshot window","section":"default","is_weak":true} 
{"comment":"automatically screenshot every frame; issue this command again to stop taking screenshots","priority":0,"key":"Alt+s","cmd":"screenshot each-frame","section":"default","is_weak":true} 
{"comment":"decrease panscan","priority":0,"key":"w","cmd":"add panscan -0.1","section":"default","is_weak":true} 
{"comment":"shrink black bars by cropping the video","priority":0,"key":"W","cmd":"add panscan +0.1","section":"default","is_weak":true} 
{"comment":"shrink black bars by cropping the video","priority":0,"key":"e","cmd":"add panscan +0.1","section":"default","is_weak":true} 
{"comment":"cycle the video aspect ratio (\"-1\" is the container aspect)","priority":0,"key":"A","cmd":"cycle-values video-aspect-override \"16:9\" \"4:3\" \"2.35:1\" \"-1\"","section":"default","is_weak":true} 
{"key":"POWER","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAY","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAYPAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"unpause","priority":0,"key":"PLAYONLY","cmd":"set pause no","section":"default","is_weak":true} 
{"comment":"pause","priority":0,"key":"PAUSEONLY","cmd":"set pause yes","section":"default","is_weak":true} 
{"key":"STOP","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"FORWARD","cmd":"seek 60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"REWIND","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"NEXT","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"PREV","cmd":"playlist-prev","section":"default","is_weak":true} 
{"key":"VOLUME_UP","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"key":"VOLUME_DOWN","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"comment":"toggle mute","priority":0,"key":"MUTE","cmd":"cycle mute","section":"default","is_weak":true} 
{"key":"CLOSE_WIN","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"key":"Ctrl+w","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"switch edition","priority":0,"key":"E","cmd":"cycle edition","section":"default","is_weak":true} 
{"comment":"set/clear A-B loop points","priority":0,"key":"l","cmd":"ab-loop","section":"default","is_weak":true} 
{"comment":"toggle infinite looping","priority":0,"key":"L","cmd":"cycle-values loop-file \"inf\" \"no\"","section":"default","is_weak":true} 
{"key":"Ctrl+c","priority":0,"cmd":"quit 4","section":"default","is_weak":true} 
{"comment":"cycle OSC visibility between never, auto (mouse-move) and always","priority":0,"key":"DEL","cmd":"script-binding osc/visibility","section":"default","is_weak":true} 
{"comment":"toggle hardware decoding","priority":0,"key":"Ctrl+h","cmd":"cycle-values hwdec \"auto\" \"no\"","section":"default","is_weak":true} 
{"comment":"show the playlist","priority":0,"key":"F8","cmd":"show-text ${playlist}","section":"default","is_weak":true} 
{"comment":"show the list of video, audio and sub tracks","priority":0,"key":"F9","cmd":"show-text ${track-list}","section":"default","is_weak":true} 
{"comment":"seek to the previous chapter","priority":0,"key":"!","cmd":"add chapter -1","section":"default","is_weak":true} 
{"comment":"seek to the next chapter","priority":0,"key":"@","cmd":"add chapter 1","section":"default","is_weak":true} 
{"comment":"forward","priority":5,"key":"RIGHT","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"LEFT","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"comment":"forward","priority":5,"key":"WHEEL_UP","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"WHEEL_DOWN","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"key":"-","priority":5,"cmd":"keypress {","section":"default","is_weak":false} 
{"key":"=","priority":5,"cmd":"keypress }","section":"default","is_weak":false} 
{"key":"q","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true} 
{"key":"ESC","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true} 
{"key":"CLOSE_WIN","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true}

Zren avatar May 22 '22 00:05 Zren

Ctrl+F to search for setButtonTooltip to edit the tooltips.

https://github.com/Zren/mpv-osc-tethys/blob/master/osc_tethys.lua#L3475

As for osc_tethys.lua dynamically parsing the shortcut keys and using them in the tooltips, I'd have to look into it.

  • https://github.com/mpv-player/mpv/blob/master/etc/input.conf
  • https://github.com/mpv-player/mpv/search?q=input.conf
  • https://github.com/mpv-player/mpv/blob/f9fd50c6546f2fa510251267d6423d3f342ca115/player/lua/defaults.lua#L138

Thank you for your timely reply! I have modified the tooltips and am very satisfied.

However, updating the hover animations according to the input.conf looks a bit complicated...

phyzhenli avatar May 22 '22 03:05 phyzhenli

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

Zren avatar May 25 '22 05:05 Zren

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

incorrect forward/back tooltips.

a seek -0.1 keyframes
d seek +0.1 keyframes

debugzxcv avatar May 27 '22 08:05 debugzxcv

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

Yes! It works great on my machine. Thank you for your help!

phyzhenli avatar May 27 '22 08:05 phyzhenli

I've added a speed button like netflix, and in the process realized how annoying parsing int/real numbers are since lua doesn't have conditional groups, so I can't parse a positive or negative integer with ((%-)?%d+). And I can't use (%d+(%.%d+))? to match an integer or a real number.

http://www.lua.org/manual/5.2/manual.html#6.4.1

...Though now that I think of it, I could probably use [%d%.]+ to match integer 1 /real numbers 1.0. It would also match 1.0.0 and 1. and 1... but whatever.

Edit: I can use a conditional on just %+? though, so that works.


incorrect forward/back tooltips.

a seek -0.1 keyframes
d seek +0.1 keyframes

Hmmm, yeah, I'm not currently searching for real numbers, so that's why it doesn't work. I hadn't thought about a + in front of positive numbers though, so thanks for pointing that out.

The -0.1 tooltip is Forward 0s {\bord(3)\b(700)} a {\bord(1)\b(400)} while the +0.1 is ignored atm.

local seekBackBinds = grepBindByCmd("^seek(%s+)(%-[%d%.]+)", {"REWIND", "Shift+PGDWN"})
local seekFrwdBinds = grepBindByCmd("^seek(%s+)(%+?[%d%.]+)", {"FORWARD", "Shift+PGUP"})
...
local seekBy = bind.cmd:match("^seek%s+([%+%-]?[%d%.]+)")
seekBy = tonumber(seekBy) -- Note: +0.1 is parsed okay
...
return ("Back %ss %s"):format(-seekBy, formatBindKey(bind.key)) -- Had to change %d to %s to print real numbers

I just noticed the Shift+ArrowKeys are also missing, as they use no-osd seek. If I do parse them, I'll probably ignore them in the tooltip though...

// no-osd seek
{"priority":0,"is_weak":true,"key":"Shift+UP","mods":"Shift","section":"default","cmd":"no-osd seek  5 exact","mods_count":1,"comment":"seek exactly 5 seconds forward"} 
{"priority":0,"is_weak":true,"key":"Shift+DOWN","mods":"Shift","section":"default","cmd":"no-osd seek -5 exact","mods_count":1,"comment":"seek exactly 5 seconds backward"} 
{"priority":0,"is_weak":true,"key":"Shift+LEFT","mods":"Shift","section":"default","cmd":"no-osd seek -1 exact","mods_count":1,"comment":"seek exactly 1 second backward"} 
{"priority":0,"is_weak":true,"key":"Shift+RIGHT","mods":"Shift","section":"default","cmd":"no-osd seek  1 exact","mods_count":1,"comment":"seek exactly 1 second forward"}

Zren avatar May 27 '22 14:05 Zren