mdhiggins / PlexAutoSkip

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

Wrong client IP when trying to connect #50

Closed pugson closed 1 year ago

pugson commented 1 year ago

I'm unable to get autoskip working on any client. Went through the wiki and closed issues multiple times — including checking if I can get the XML player values by accessing the client's IP with my Plex token directly, which seems to be working fine. GDM is enabled.

Looking at debug logs it seems like the script is trying to connect to the router's IP address (192.168.1.1) rather than the Plex server's IP (192.168.111) or the client's (192.168.1.191).

I'm running it in Docker on an Unraid server where Plex is also hosted.

Any idea what might be happening here?

config.ini ```ini [Plex.tv] username = pugson password = servername = token = [Server] address = 192.168.1.111 ssl = False port = 32400 [Security] ignore-certs = False [Skip] mode = skip tags = intro types = movie, episode ignored-libraries = last-chapter = 0.0 unwatched = True first-episode-series = Watched first-episode-season = Always first-safe-tags = next = False [Binge] ignore-skip-for = 0 safe-tags = same-show-only = False skip-next-max = 0 [Offsets] start = 3000 end = 1000 command = 500 tags = intro [Volume] low = 0 high = 100 ```
custom.json ```json { "markers": {}, "offsets": {}, "tags": {}, "allowed": { "users": [], "clients": [], "keys": ["tmdb://2316", "tmdb://2190"], "skip-next": [] }, "blocked": { "users": [], "clients": [], "keys": [], "skip-next": [] }, "clients": {}, "mode": {} } ```
Logs ```vim INFO - Found new session 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 viewOffset 0 pugson on Plex for iOS (proxying: False), sessions: 0 INFO - Found skippable marker intro for media 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 with range 80346(+3000)-113614(+1000) and viewOffset 83433 INFO - Seeking Plex for iOS player playing 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 from 83434 to 114614 ERROR - Exception, removing from cache to prevent false triggers, will be restored with next sync Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 200, in _new_conn sock = connection.create_connection( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen response = self._make_request( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request conn.request( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 388, in request self.endheaders() File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/usr/lib/python3.10/http/client.py", line 976, in send self.connect() File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 236, in connect self.sock = self._new_conn() File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 215, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen retries = retries.increment( File "/usr/local/pas/venv/lib/python3.10/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.1.1', port=32500): Max retries exceeded with url: /player/playback/seekTo?commandID=1&offset=114614&type=video (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/pas/resources/skipper.py", line 212, in _seekTo self.seekPlayerTo(mediaWrapper.player, mediaWrapper, targetOffset) File "/usr/local/pas/resources/skipper.py", line 238, in seekPlayerTo mediaWrapper.seekTo(targetOffset, player) File "/usr/local/pas/resources/mediaWrapper.py", line 365, in seekTo player.seekTo(offset) File "/usr/local/pas/venv/lib/python3.10/site-packages/plexapi/client.py", line 377, in seekTo self.sendCommand('playback/seekTo', offset=offset, type=mtype) File "/usr/local/pas/venv/lib/python3.10/site-packages/plexapi/client.py", line 232, in sendCommand return query(key, headers=headers) File "/usr/local/pas/venv/lib/python3.10/site-packages/plexapi/client.py", line 184, in query response = method(url, headers=headers, timeout=timeout, **kwargs) File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.1', port=32500): Max retries exceeded with url: /player/playback/seekTo?commandID=1&offset=114614&type=video (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) INFO - Found new session 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 viewOffset 83959 pugson on Plex for iOS (proxying: False), sessions: 0 INFO - Found skippable marker intro for media 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 with range 80346(+3000)-113614(+1000) and viewOffset 84203 INFO - Seeking Plex for iOS player playing 14 [35744] (The Office (US) s03e02 - The Convention) iPhone|A11E6F38-DD16-49D1-BE0F-6FC314E897F4 from 84203 to 114614 ERROR - Exception, removing from cache to prevent false triggers, will be restored with next sync Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 200, in _new_conn sock = connection.create_connection( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen response = self._make_request( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request conn.request( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 388, in request self.endheaders() File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/usr/lib/python3.10/http/client.py", line 976, in send self.connect() File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 236, in connect self.sock = self._new_conn() File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connection.py", line 215, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/pas/venv/lib/python3.10/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/usr/local/pas/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen retries = retries.increment( File "/usr/local/pas/venv/lib/python3.10/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.1.1', port=32500): Max retries exceeded with url: /player/playback/seekTo?commandID=1&offset=114614&type=video (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) ```
mdhiggins commented 1 year ago

When you look your Plex activity in the Plex web app are the appropriate IP addresses displayed for the players?

pugson commented 1 year ago

Problem solved. Thank you!

I had my Plex container in bridge mode in Unraid. Changing it to host made everything work properly.