Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get seek-to.lua to work :( #11

Open
pjotrek-b opened this issue Oct 26, 2023 · 5 comments
Open

Can't get seek-to.lua to work :( #11

pjotrek-b opened this issue Oct 26, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@pjotrek-b
Copy link

I've downloaded your code and saved it to ".config/mpv/scripts/seek-to.lua" - and restarted MPV (as works with the other lua scripts I have in that folder).

But when I paste the following timecode using "Ctrl+Alt+V" nothing happens, and mpv says it ain't responsible for that keyboard shortcut.
The timecode was: 00:01:03.12 - and the video was 2m20s long. So it should work, right?

Can I help debugging this?

Thank you very much in advance!

System:

  • Xubuntu 20.04
  • mpv v0.32.0 (I know it ain't the latest)
@dexeonify
Copy link
Owner

Hmm, that's definitely unexpected. The paste_timestamp function of the script should work OOTB. If the timestamp is invalid, or there's a problem retrieving the clipboard data, there should be an error message in the console. To be clear, this script isn't tested on Linux, but if what you say is true:

mpv says it ain't responsible for that keyboard shortcut.

then it failed at the registering the keybinds, which suggests a different issue entirely.

Does manually adding the keybinds in input.conf works? For example:

t        script-message-to seek_to toggle-seeker
Alt+t    script-message-to seek_to paste-timestamp

If neither of the keybinds work, it's probably an issue in your mpv config.

@dexeonify dexeonify added the bug Something isn't working label Oct 27, 2023
@pjotrek-b
Copy link
Author

Thanks for your reply! :)

I've tried again now, and keybinding seems to be recognized now.
No more message:
"No key binding found for key 'Ctrl+Alt+V'".

So key-bindings seem to be fine now.
With the above lines written to (a new) "/etc/input.conf", pressing "t" shows me a "seek to" message - but "Alt+T" (Or Ctrl+Alt+V) still does nothing.

I'm starting MPV from the commandline to see the logging output in the shell:
I don't get any error messages. Just "nothing happens".

@pjotrek-b
Copy link
Author

I've added a dummy-messages to "paste_timestamp()" - to see if (and how far) it's being executed:

Seems it never gets past the "if clipboard == nil then return end" line.
I suspect it may not be able to read the clipboard contents on my system. Will check if I can edit "get_clipboard()" to make it work 😄

@pjotrek-b
Copy link
Author

Seems that the "platform" string cannot be read (is nil)?

local platform = mp.get_property_native("platform")
mp.osd_message("platform" .. platform)

Throws:

[seek_to] Lua error: ~/.config/mpv/scripts/seek-to.lua:8: attempt to concatenate local 'platform' (a nil value)

...so the "get_clipboard()" function has no chance 😉
I'll see if I can list MPV's properties to find out why.

@dexeonify
Copy link
Owner

Ah yes, the platform property was added in mpv-player/mpv@80feac6, which is only available from v0.36.0 forward. I've anticipated it, but I also didn't feel like adding workaround/hacks for the few people who are aware about my fork.

I would definitely vouch for upgrading mpv, but if you can't, you can either hardcode the platform variable as linux (an ugly solution, I know) or implement the boilerplate code mentioned in the mpv commit above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants