iamkroot / trakt-scrobbler

Scrobbler for trakt.tv that supports VLC, Plex, MPC-HC, and MPV.
https://github.com/iamkroot/trakt-scrobbler/wiki
GNU General Public License v2.0
449 stars 30 forks source link

[BUG] TypeError #248

Closed george-emerald closed 5 months ago

george-emerald commented 1 year ago

Describe the bug

A TypeError esception is raised which stops the program from doing anything other than whitelist.

Desktop (please complete the following information):

To Reproduce

Just running trakts init does it.

Log file

Click to see log contents

``` 2023-05-02 19:41:50,918 - DEBUG - MainThread - monitor - Autoloaded mpv ipc_path = tmp/mpvsocket 2023-05-02 19:41:50,918 - INFO - MainThread - monitor - Started monitor for mpv 2023-05-02 19:41:58,199 - DEBUG - mpv - mpv - Sock closed 2023-05-02 19:41:58,303 - DEBUG - mpv - mpv - Sock closed 2023-05-02 19:41:58,412 - DEBUG - mpv - mpv - Sock closed 2023-05-02 19:41:58,594 - DEBUG - mpv - mpv - Sock closed 2023-05-02 19:41:58,765 - DEBUG - mpv - mpv - Sock closed 2023-05-02 19:41:58,934 - INFO - mpv - mpv - Unable to connect to MPV. Check ipc path. 2023-05-02 19:43:52,469 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:44:05,982 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:44:34,710 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:46:41,359 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:47:21,279 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:51:19,043 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:53:59,698 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 19:59:45,482 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 20:03:03,417 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 20:03:21,290 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt 2023-05-02 20:06:33,263 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.pause, scrobble.resume, scrobble.start, scrobble.stop, trakt ```

Traceback

TypeError

  issubclass() arg 1 must be a class

  at .local/pipx/venvs/trakt-scrobbler/lib/python3.11/site-packages/rubicon/objc/runtime.py:1027 in add_method
      1023│ 
      1024│     signature = [ctype_for_type(tp) for tp in encoding]
      1025│     assert signature[1] == objc_id  # ensure id self typecode
      1026│     assert signature[2] == SEL  # ensure SEL cmd typecode
    → 1027│     if signature[0] is not None and issubclass(signature[0], (Structure, Union)):
      1028│         # Patch struct/union return types to make them work in callbacks.
      1029│         # See the source code of the ctypes_patch module for details.
      1030│         ctypes_patch.make_callback_returnable(signature[0])
      1031│     selector = SEL(selector)
george-emerald commented 1 year ago

Something was off with the symlink. I fixed it by running which python3.11 and creating a new symlink.

george-emerald commented 1 year ago

Nevermind it happened again. I've tried everything. Uninstall pipx and its shared libraries I can't fix it. Please help. It was also not showing any notifications when it run for a bit.

iamkroot commented 1 year ago

Try rerunning the command with -vvv flag to get the full stacktrace. Should help us find out where the error is coming from

george-emerald commented 1 year ago

I found a workaround of sorts. I uninstalled it using pipx, then uninstalled pipx with brew, downloaded iTerm2, ran it using Rosetta, installed x86 brew, then x86 pipx, then x86 trakt-scrobbler and it worked. Brew failed a bit when installing pipx because it couldn't overwrite the already-existing arm python symlinks but it somehow works. Still getting no notifications though. Both Python and Script Editor have notification permissions so I dont know how that's happening.

george-emerald commented 1 year ago

Do you know why this was suddenly needed or why I'm not getting notifications? Everything worked fine until recently.

george-emerald commented 1 year ago

I'm getting this in trakts test mpv -vvv

Notification Center can only be used from a signed Framework or app bundle

How do I solve it, @iamkroot ?

iamkroot commented 1 year ago

This looks like a regression caused by our switch to desktop-notifier for sending notifications. Quoting the docs-

On macOS 10.14 and higher, the implementation uses the UNUserNotificationCenter instead of the deprecated NSUserNotificationCenter. UNUserNotificationCenter restricts sending desktop notifications to signed executables. This means that notifications will only work if the Python executable or bundled app has been signed. Note that the installer from python.org provides a properly signed Python framework but homebrew does not (manually signing the executable installed by homebrew should work as well).

So, you need to use the python exec from python.org for it to send notifications, or bundle up this app and sign it yourself.

george-emerald commented 1 year ago

I use python from homebrew as it's running within Rosetta currently. How can I sign it myself? Would I need to build it?

iamkroot commented 1 year ago

I don't have any experience with macos, so can't help you there. Try going through https://github.com/Homebrew/brew/issues/9082 maybe? Or you could raise an issue in the desktop-notifier github repo https://github.com/samschott/desktop-notifier

iamkroot commented 5 months ago

Closing due to inactivity.