jaseg / python-mpv

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

Invalid `None` default for `level` in `show_text` #226

Closed The-Compiler closed 2 years ago

The-Compiler commented 2 years ago

Doing:

import mpv
player = mpv.MPV()
player.show_text("Hello World!")

with python-mpv 1.0.1 and mpv 0.34.1 results in:

ValueError: ('Invalid value for mpv parameter', -4, (<MpvHandle object at 0x7fe8ec233e40>, <mpv.LP_MpvNode object at 0x7fe8eb99c3c0>, <mpv.LP_MpvNode object at 0x7fe8eb99c340>))

which seems to happen due to the level=None here:

https://github.com/jaseg/python-mpv/blob/20ec2a74b8c407e1fcaabb1554a4acd83bb57bb9/mpv.py#L1393

when instead using:

player.show_text("Hello World!", level=1)

it works fine.

trin94 commented 2 years ago

I can confirm that this issue exists.

❯ mpv --osd-level=help
Valid values for option osd-level are:
    0
    1
    2
    3

Changing the level default parameter from None to 0 fixes the issue.

Edit: pull request created #229