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

Passing Command-Line Options Directly To MPV? #243

Closed hendursaga closed 1 year ago

hendursaga commented 1 year ago

Suppose I had a script that, like in bash and most other POSIX tools, stopped processing options past --, the so-called end of options convention. How might I pass those unprocessed options directly to mpv? I see MPV's constructor has extra_mpv_flags as well as extra_mpv_opts, but that would mean I'd have to do some processing, no? I can't just pass a string. How do I get around this?

jaseg commented 1 year ago

You could use extra_mpv_opts. I don't think you should have to do any processing, you just have to remove the leading dashes and put them in an {option: value} dict like this:

extra_options = {'fullscreen': 'yes', 'keep-open': 'yes'}
player = mpv.MPV(..., **extra_options)