trakt / Plex-Trakt-Scrobbler

Add what you are watching on Plex to trakt.tv
1.45k stars 166 forks source link

Scrobbling failing sometimes due to MaxRetryError #600

Open darkcoderrises opened 3 years ago

darkcoderrises commented 3 years ago

For the past month or so, scrobbling has been really random for me. If I am binging a series, only some of the episodes would get marked. I looked at the logs and found this error:

2021-08-07 00:27:15,439 - plugin.managers.action           (7f2c5342fb38) :  ERROR (plugin.managers.action:161) - Unable to send action u'scrobble/pause': ConnectionError(MaxRetryError("HTTPSConnectionPool(host='api.trakt.tv', port=443): Max retries exceeded with url: /scrobble/pause (Caused by ProtocolError('Connection aborted.'))"),)
Traceback (most recent call last):
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/managers/action.py", line 159, in process
    result = cls.send(action, Trakt[interface][method], request)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/managers/action.py", line 222, in send
    return func(**request)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/base/__init__.py", line 36, in wrap
    return func(*args, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/base/__init__.py", line 20, in wrap
    return func(*args, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/scrobble.py", line 333, in pause
    **kwargs
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/base/__init__.py", line 36, in wrap
    return func(*args, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/base/__init__.py", line 20, in wrap
    return func(*args, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/scrobble.py", line 128, in action
    'validate_token'
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 152, in post
    return self.request('POST', path, params, data, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 107, in request
    return self.send(prepared)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 125, in send
    response = self.session.send(request, timeout=timeout)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
ConnectionError: MaxRetryError: HTTPSConnectionPool(host='api.trakt.tv', port=443): Max retries exceeded with url: /scrobble/pause (Caused by ProtocolError('Connection aborted.'))

How should this error be fixed? Can we increase the max retries? Is this something that trakt is enforcing?

CrypticOne commented 3 years ago

I am getting this too but only on my QNAP install. No errors on Synology that it syncs played items with. Sadly, This project is mostly abandoned at this point. Last I searched it was still the best tool for my usage case. I may try to look at the code but it is pretty large.

I find that stopping and starting Plex might reset the issue at least temporarily.

I am not sure your usage case but I found some projects that might work for me.

https://github.com/Fmstrat/plex-cluster From the coder of plex-db-sync

https://github.com/speijnik/plex-watched-sync

This one works with trak and seems to be pretty active. https://github.com/twolaw/PlexTraktSync

darkcoderrises commented 3 years ago

Thanks. So I wrote a retry counter in the code, and it worked. I will send a pull request.

CrypticOne commented 3 years ago

Nice!

darkcoderrises commented 3 years ago

https://github.com/trakt/Plex-Trakt-Scrobbler/pull/602