jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
531 stars 67 forks source link

[QUESTION] How do I add custom scripts? #276

Closed TheCheddarCheese closed 2 months ago

TheCheddarCheese commented 2 months ago

I installed a SponsorBlock script normally and it works when I open MPV though the app menu, but not with Python. How can I make it run in the module too?

dfaker commented 2 months ago

there's

player.command('load-script','scriptname.lua')

jaseg commented 2 months ago

Note that because python-mpv uses libmpv, it by default does not load the mpv configuration that you have in your home directory. This means any settings, key bindings or user scripts that you have installed for the mpv command-line interface will not be loaded by default by python-mpv.

You can however explicitly tell python-mpv to load the same user configuration that the regular mpv command-line utility loads by passing config=True to the mpv.MPV constructor like mpv.MPV(.., config=True, ...). See this issue and this comment from the libmpv documentation for details.