How to control mpv through neovim? #14819
Unanswered
lovelindhoni
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Not parsing terminal output refers to log messages. You are supposed to read the output of the JSON IPC. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, I am trying to read the output from the JSON IPC using neovim's luvref bindings. function send_mpv_command()
local pipe = uv.new_pipe(false)
pipe:connect(mpv_socket, function(err)
if err then
print("Error connecting :", err)
return
end
local command = '{ "command": ["get_property", "metadata"] }\n'
print("Connected ", mpv_socket)
pipe:write(command, function(write_err)
if write_err then
print("Error writing to socket:", write_err)
else
print("Command sent to MPV")
end
pipe:shutdown() -- shutdown of the writing side of the pipe
pipe:read_start(function(read_err, data)
if read_err then
print("Error reading socket:", read_err)
elseif data then
print(data)
else
print("MPV socket closed")
end
pipe:close()
end)
end)
end)
end I can't see any data is prevented. It works perfectly well for commands such as |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing some nvim functions that controls the playback of mpv through the IPC connection. I would lke to read some data like the filtered-metadata of a file, but its said in the manual that reading from the terminal output is a bad idea. Can I get some heads-up on how to use mpv's lua scripting here, get the data from the lua scripts into the context of nvim
Thanks
Beta Was this translation helpful? Give feedback.
All reactions