Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua script not working #41

Closed
za4410 opened this issue Jul 31, 2017 · 4 comments
Closed

lua script not working #41

za4410 opened this issue Jul 31, 2017 · 4 comments

Comments

@za4410
Copy link

za4410 commented Jul 31, 2017

Just tried setting script property to a lua script:

player['script'] = "/path/to/test.lua"

It gives me this error:
RuntimeError: ('Generic error getting or setting mpv property', -11, (<MpvHandle object at 0x7f7e33d78a60>, b'options/script', b'/path/to/test.lua'))

It works by running mpv directly: mpv input.mov --script=/path/to/test.lua

The lua script is simply the one from mpv docs:

function on_pause_change(name, value)
    if value == true then
        mp.set_property("fullscreen", "no")
    end
end
mp.observe_property("pause", "bool", on_pause_change)
@jaseg
Copy link
Owner

jaseg commented Aug 1, 2017

I was able to reproduce this. The problem seems to be that mpv loads the lua scripts from the --script option on initialization and does not accept later changes to that option. From what I can tell the only way to make this work ATM is to pass script='some_script.lua to the MPV contructor. Any options you pass there will be set before the mpv handle is initialized.

@za4410
Copy link
Author

za4410 commented Aug 1, 2017

That will work! Right now when I pass script to MPV constructor it won't complain, but nothing happens either. Is this already supported?

@jaseg
Copy link
Owner

jaseg commented Aug 2, 2017

I'll have to look into this some more. I just tested it and the lua script gets loaded properly, but the fullscreen property does not seem to work from either lua or python when using libmpv.

@jaseg
Copy link
Owner

jaseg commented Aug 2, 2017

I was able to reproduce that the fullscreen property is a bit wonky on my fedora 25 but I was unable to reproduce it on debian sid running mpv v0.26.0. So I suspect that this behavior is in fact due to an upstream bug and I would suggest you to just try updating your mpv version to something really recent.

Due to a change in the options API you will also have to rename the script option in your python source code to scripts .

I'll close this issue for now. If there is anything left unclear, please go ahead and repoen it.

@jaseg jaseg closed this as completed Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants