jaseg / python-mpv

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

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

Closed TheCheddarCheese closed 7 months ago

TheCheddarCheese commented 7 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 7 months ago

there's

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

jaseg commented 7 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.