Closed bergercookie closed 3 years ago
Hey there,
the reason for this is that when run from libmpv (as happens in this python module), mpv by default does not load any user configuration--and that includes user lua scripts. See https://github.com/mpv-player/mpv/blob/e27c523a10708b7265c33a4bae631663df4bb297/libmpv/client.h#L434
To work around this, initialize the MPV object like mpv.MPV(config=True, ...)
. This will load the user's config, and will also load the user's scripts. If you just want to load a specific script, you can also pass the --scripts
option: mpv.MPV(scripts=['/path/to/some/script.lua'])
. This will selectively load that script, without loading user config. If you want to ship your own config with your python script, you can do that using the --config-dir
option along with config=True
.
Best, jaseg
Cheers @jaseg ,
Using config=True
indeed solves it and I can see in the debug logs (when using log_handler=debug_print
) that it indeed tries to load the so script.
However, now I'm facing a different error which I've described in this ticket: https://github.com/hoyon/mpv-mpris/issues/43
Not sure if this is related to mpv-mpris or to your project though.. let me know if you have any hints otherwise feel free to close this.
Your problem is with mpv-mpris. They use a function mpv_get_property
instead of mpv_get_property_node
or mpv_get_property_string
in one place. That function seems to have disappeared from mpv recently, so it was probably deprecated API. mpv-mpris needs to replace that with one of the current public API functions from mpv's client.h
.
Hi there,
Thanks for these awesome bindings!
I've successfully used python-mpv to play a radio stream and also grab the metadata using something the following:
I have also installed mpv-pris shared object under
~/.config/mpv/scripts
so that I can send the currently playing track via dbus and display it in my window manager toolbar.When running the stream via the command line (
mpv https://somafm.com/defcon130.pls
), the script is utilised and the track name is displayed successfully. However, when running mpv via the python wrapper, that's not the case and it doesn't seem to pick up thempris.so
object installed under ~/.config/mpv/scripts.Is there anything I'm missing? Any property I should be setting for it to do so? AFAICT
player.load_scripts
is set to True on thempv.MPV
objectThanks