Log in

View Full Version : libmpv development with C#


stax76
23rd July 2017, 21:29
Does anybody know if libmpv supports the OSC?

I wanted to learn Lua and thought it's nice but then I realized that I would need too much time to learn it. Now I want to try to script the player with JavaScript, does anybody know if I can rename a file or start a process that renames a file?

Are there other players that are scriptable/extendable? I know VLC supports Lua scripting and Kodi supports Python scripting.

avih
27th July 2017, 04:47
Does anybody know if libmpv supports the OSC?


Not sure. Regardless, I think typically you'd use libmpv to embed the video content in a GUI of your own.


I wanted to learn Lua and thought it's nice but then I realized that I would need too much time to learn it. Now I want to try to script the player with JavaScript, does anybody know if I can rename a file or start a process that renames a file?


Lua in mpv has its standard library available - through which you can most probably rename a file (probably via the "io" module).

Both Lua and JS in mpv support "mp.utils.readdir()" and "mp.utils.subprocess" command to execute an arbitrary program with arguments, which you could probably use to rename a file.

JS in mpv also has high level functions for reading and writing (but not deleting) plain text files, so depending on your exact needs, it might be enough.

See https://mpv.io/manual/master/#lua-scripting and https://mpv.io/manual/master/#javascript .

stax76
27th July 2017, 12:18
Thanks for the help, mp.utils.subprocess should work for me, I need it to write a rating to the filename of the video files.