mdhiggins / PlexAutoSkip

Automatically skip content in Plex
MIT License
205 stars 11 forks source link

Connection timed out on Windows desktop plex client (compatible version) #52

Closed Catastrope42 closed 1 year ago

Catastrope42 commented 1 year ago

I have set up everything according to the guide, and it does work on my phone within the same network, but even though I downgraded the desktop client, and it gets detected, when it comes to skipping the connection times out.

Here is a section of the log with the full detailed error:

`2023-08-21 14:28:31 - __main__ - INFO - Found new session 9 [4332] (Family Guy s04e17 - The Fat Guy Strangler) CATA-PC|qrml18uum72fq6046un3z5x5 viewOffset 0 Catastrope on Plex for Windows (proxying: False), sessions: 0
2023-08-21 14:28:32 - __main__ - INFO - Found skippable marker intro for media 9 [4332] (Family Guy s04e17 - The Fat Guy Strangler) CATA-PC|qrml18uum72fq6046un3z5x5 with range 990(+3000)-30297(+1000) and viewOffset 1829
2023-08-21 14:28:32 - __main__ - INFO - Seeking Plex for Windows player playing 9 [4332] (Family Guy s04e17 - The Fat Guy Strangler) CATA-PC|qrml18uum72fq6046un3z5x5 from 1829 to 31297
2023-08-21 14:28:53 - __main__ - ERROR - Exception, removing from cache to prevent false triggers, will be restored with next sync
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connection.py", line 203, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
    raise err
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request
    conn.request(
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connection.py", line 395, in request
    self.endheaders()
  File "C:\Program Files\Python311\Lib\http\client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files\Python311\Lib\http\client.py", line 1041, in _send_output
    self.send(msg)
  File "C:\Program Files\Python311\Lib\http\client.py", line 979, in send
    self.connect()
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connection.py", line 243, in connect
    self.sock = self._new_conn()
                ^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connection.py", line 212, in _new_conn
    raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x00000185583E24D0>, 'Connection to 192.168.0.31 timed out. (connect timeout=30)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.0.31', port=32700): Max retries exceeded with url: /player/playback/seekTo?commandID=1&offset=31297&type=video (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x00000185583E24D0>, 'Connection to 192.168.0.31 timed out. (connect timeout=30)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\PlexAutoSkip-master\resources\skipper.py", line 212, in _seekTo
    self.seekPlayerTo(mediaWrapper.player, mediaWrapper, targetOffset)
  File "C:\PlexAutoSkip-master\resources\skipper.py", line 238, in seekPlayerTo
    mediaWrapper.seekTo(targetOffset, player)
  File "C:\PlexAutoSkip-master\resources\mediaWrapper.py", line 373, in seekTo
    player.seekTo(offset)
  File "C:\Program Files\Python311\Lib\site-packages\plexapi\client.py", line 378, in seekTo
    self.sendCommand('playback/seekTo', offset=offset, type=mtype)
  File "C:\Program Files\Python311\Lib\site-packages\plexapi\client.py", line 233, in sendCommand
    return query(key, headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\plexapi\client.py", line 185, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\requests\sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\requests\adapters.py", line 507, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.0.31', port=32700): Max retries exceeded with url: /player/playback/seekTo?commandID=1&offset=31297&type=video (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x00000185583E24D0>, 'Connection to 192.168.0.31 timed out. (connect timeout=30)'))`

Again, the same system seems to be working fine with other, albeit mobile devices on the network. I have disabled firewall, even tried checking pinging both pcs from one another (it works), yet couldn't figure out the timeout error. Hope it's solveable

Thank you in advance

mdhiggins commented 1 year ago

What version of the desktop player are you running?

Catastrope42 commented 1 year ago

Version 1.41.0.2876-e960c9ca which was recommended to me from a thread on reddit

mdhiggins commented 1 year ago

Hm, just checked that same client on my machine and its working fine but the key difference is that mine correctly defaults to proxying through the server. The desktop and web clients (before they removed support) never supported direct IP commands like the rest of the clients and always had to be proxied through the server. There's a series of checks used by looking at the IP address comparison between the client IP and the server reported client IP to determine if it should just default to proxy mode but for whatever that appears to be failing on your setup.

One way to override that would be to add your web player client id to custom.json and set the value to "proxy"

{
    "markers": {},
    "offsets": {},
    "tags": {},
    "allowed": {
        "users": [],
        "clients": [],
        "keys": [],
        "skip-next": []
    },
    "blocked": {
        "users": [],
        "clients": [],
        "keys": [],
        "skip-next": []
    },
    "clients": {
        "CATA-PC": "proxy"
    },
    "mode": {}
}

If you wanted to do some debugging on why the automated check is failing I can write some debug code for you to run and share the output though given all these clients are now deprecated if you don't want to bother that manual proxy override should fix it for you

Catastrope42 commented 1 year ago

Now the error has changed to something completely different. I did go to the page, and did the steps. Same subnet, restarted plex etc but didn't seem to fix the issue. Here is the log:

2023-08-21 16:16:40 - __main__ - INFO - C:\Program Files\Python311\python.exe
2023-08-21 16:16:40 - __main__ - INFO - Loading config file C:\PlexAutoSkip-master\config\config.ini.
2023-08-21 16:16:40 - __main__ - INFO - Loading custom JSON file C:\PlexAutoSkip-master\config\custom.json
2023-08-21 16:16:40 - __main__ - INFO - Connecting to Plex server...
2023-08-21 16:16:57 - __main__ - INFO - Connected to Plex server CataServer using plex.tv account
2023-08-21 16:16:57 - __main__ - INFO - Skipper initiated and ready
2023-08-21 16:16:58 - websocket - INFO - Websocket connected
2023-08-21 16:17:10 - __main__ - INFO - Found new session 2 [4346] (Family Guy s05e02 - Mother Tucker) CATA-PC|qrml18uum72fq6046un3z5x5 viewOffset 1000 Catastrope on Plex for Windows (proxying: True), sessions: 0
2023-08-21 16:17:10 - __main__ - INFO - Found skippable marker intro for media 2 [4346] (Family Guy s05e02 - Mother Tucker) CATA-PC|qrml18uum72fq6046un3z5x5 with range 990(+3000)-28316(+1000) and viewOffset 1631
2023-08-21 16:17:10 - __main__ - INFO - Seeking Plex for Windows player playing 2 [4346] (Family Guy s05e02 - Mother Tucker) CATA-PC|qrml18uum72fq6046un3z5x5 from 1632 to 29316
2023-08-21 16:17:10 - __main__ - ERROR - 404 Error, see https://github.com/mdhiggins/PlexAutoSkip/wiki/Troubleshooting#badrequest-error
Catastrope42 commented 1 year ago

I misclicked to the close button, I apologize. By the way it works fine in both two mobile phones and my tv plex and an nvidia shield. All android of course. The only issue is with my windows pc which is the one I use the most sadly.

mdhiggins commented 1 year ago

No idea then, something with your GDM setup isn't working

Did you go through this

https://support.plex.tv/articles/201812803-plex-companion-remote-control-issues/

Feel free to share client info

There are also a few others that have had issues on their network that get either the badrequest or 404 error, search through some of the closed issues to see how they fixed things but its ultimately a plex api and networking issue at this point not a script problem, its detecting everything and now appropriately using the proxy option

Catastrope42 commented 1 year ago

I will try my best all day tomorrow, go through both that link and the old issues. Maybe something will work. I will update it here if I manage to solve it.

Catastrope42 commented 1 year ago

I couldn't resolve it. I assume it's specific to my network setup but I'm too tired to look more into it. I'll close the issue for now. Thank you so much for your help anyway, I appreciate it