iwalton3 / plex-mpv-shim

Cast media from Plex Mobile and Web apps to MPV. (Unofficial)
MIT License
368 stars 21 forks source link

Broken with latest python-mpv (1.0.1) released on Apr 24 2022 #72

Open swazrgb opened 2 years ago

swazrgb commented 2 years ago

Running plex-mpv-shim crashes with:

Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/plex-mpv-shim", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/.local/lib/python3.10/site-packages/plex_mpv_shim/mpv_shim.py", line 47, in main
    from .player import playerManager
  File "/home/ubuntu/.local/lib/python3.10/site-packages/plex_mpv_shim/player.py", line 568, in <module>
    playerManager = PlayerManager()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/plex_mpv_shim/player.py", line 235, in __init__
    def handle_end_idle(event):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mpv.py", line 1606, in register
    types = [MpvEventID.from_str(t) if isinstance(t, str) else t for t in event_types] or MpvEventID.ANY
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mpv.py", line 1606, in <listcomp>
    types = [MpvEventID.from_str(t) if isinstance(t, str) else t for t in event_types] or MpvEventID.ANY
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mpv.py", line 299, in from_str
    return getattr(kls, s.upper().replace('-', '_'))
AttributeError: type object 'MpvEventID' has no attribute 'IDLE'

Workaround:

pip3 install --upgrade python-mpv==0.5.2
ronilaukkarinen commented 2 years ago

Noticed the same. Thanks for the workaround.

yugonline commented 2 years ago

Thanks this helped!

takase1121 commented 2 years ago

This workaround no longer works as a recent update to mpv 0.35.0 that requires python-mpv==1.0.1. It's a catch-22 situation.

EDIT: Looks like this will require a complete rewrite to adopt python-mpv v1.0.1.

polyzen commented 2 years ago

You can either backport a patch to python-mpv 0.5.2 or use external mpv mode: https://aur.archlinux.org/packages/python-mpv#comment-889644 https://aur.archlinux.org/packages/python-mpv#comment-889648

takase1121 commented 2 years ago

Thanks for pointing this out!

iwalton3 commented 1 year ago

I just pushed a fix that should make it compatible with python-mpv 1.0.1. Please let me know if that works.

You can also use external MPV to work around this issue.

You can install the test fix using:

sudo pip3 install --upgrade git+https://github.com/iwalton3/plex-mpv-shim
polyzen commented 1 year ago

@iwalton3, works for me 👍