Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlexAutoSkip not working when Plex in docker is not using host network #69

Open
ryaneford opened this issue May 12, 2024 · 6 comments
Open

Comments

@ryaneford
Copy link

ryaneford commented May 12, 2024

Hi,

I have Plex and Autoskip in my docker setup with them assigned to a docker network.

When I assign the config the LAN ip (192.168.0.7), while in the docker network (Plex sees it at 172.18.0.5), it connects, but then throws errors when attempting to do anything..

requests.exceptions.ConnectionError: HTTPConnectionPool(host='172.18.0.1', port=32500): Max retries exceeded with url: /player/playback/stop?commandID=1&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f81707437c0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2024-05-11 20:02:59 - __main__ - INFO - Found new session 3 [2277] (Teen Titans Go! s02e11 - Love Monsters) Apple TV|AD760B89-2E4B-478F-9793-911E6375E741 viewOffset 0 ryaneford on Plex for Apple TV (proxying: False), sessions: 0
2024-05-11 20:13:36 - __main__ - INFO - /usr/local/pas/venv/bin/python3
2024-05-11 20:13:36 - __main__ - INFO - Loading config file /usr/local/pas/config/config.ini.
2024-05-11 20:13:36 - __main__ - INFO - Loading custom JSON file /usr/local/pas/config/custom.json
2024-05-11 20:13:36 - __main__ - INFO - Connecting to Plex server...
2024-05-11 20:14:07 - __main__ - INFO - Connected to Plex server Synoplex Odeon using plex.tv account
2024-05-11 20:14:07 - __main__ - INFO - Skipper initiated and ready
2024-05-11 20:14:07 - websocket - INFO - Websocket connected
2024-05-11 20:14:10 - __main__ - INFO - Found new session 5 [2278] (Teen Titans Go! s02e12 - Baby Hands) Apple TV|AD760B89-2E4B-478F-9793-911E6375E741 viewOffset 0 ryaneford on Plex for Apple TV (proxying: False), sessions: 0
2024-05-11 20:16:36 - __main__ - INFO - /usr/local/pas/venv/bin/python3
2024-05-11 20:16:36 - __main__ - INFO - Loading config file /usr/local/pas/config/config.ini.
2024-05-11 20:16:36 - __main__ - INFO - Loading custom JSON file /usr/local/pas/config/custom.json
2024-05-11 20:16:36 - __main__ - INFO - Connecting to Plex server...
2024-05-11 20:16:38 - __main__ - INFO - Connected to Plex server Synoplex Odeon using plex.tv account
2024-05-11 20:16:38 - __main__ - INFO - Skipper initiated and ready
2024-05-11 20:16:38 - websocket - INFO - Websocket connected
2024-05-11 20:16:41 - __main__ - INFO - Found new session 5 [2278] (Teen Titans Go! s02e12 - Baby Hands) Apple TV|AD760B89-2E4B-478F-9793-911E6375E741 viewOffset 151233 ryaneford on Plex for Apple TV (proxying: False), sessions: 0
2024-05-11 20:24:58 - __main__ - INFO - Found skippable marker credits for media 5 [2278] (Teen Titans Go! s02e12 - Baby Hands) Apple TV|AD760B89-2E4B-478F-9793-911E6375E741 with range 648133(+0)-662370(+0) and viewOffset 648715
2024-05-11 20:25:00 - __main__ - 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 198, 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`

From what I see, it's attempting to use the docker network gateway 'host='172.18.0.1', port=32500' (which i did not specify 32500 anywhere in this setup fyi)

I attempted to add the docker network IP assigned to plex in the config file but nothing happened. It wasn't until i removed plex and added it to the host network in docker is when it started working. I kept PlexAutoSkip in the docker network.

Is there something here that I can do to maintain my docker networks but still use this tool? Is there something i am missing?

let me know if you need any other info.

@mdhiggins
Copy link
Owner

You shouldn't need to use the host network so something else is going on

The actual connection refused error you're getting is at the time of the script trying to connect to your Plex client (Apple TV) not the server, looks like it connects to the server fine given the success message and then information it has on playback sessions this appears to be working (though maybe you're referring to some earlier attempts, without those logs can't help much in that regard)

Does your Apple TV have remote controlling enabled? That would give you a connection refused error if it does not

@ryaneford
Copy link
Author

I have all the required things set on the tvOS side. This was working when I had a previous install on a proxmox LXC with autoskip installed in the same OS Plex was in. It was the moment i put it into docker is when things got weird.

Is there anything i can provide here to give more insight?

@mdhiggins
Copy link
Owner

As far as the server not connecting, some logs of that actually happening would be nice since the current logs showed that component working fine

For it not being able to connect to your Apple TV, you should confirm that Plex Companion is running and is accessible on the Apple TV

You should be able to access the resources of the Plex Companion API on your Apple TV by navigating to

http://10.0.1.126:32500/resources?token=[MYTOKEN]

But change the IP to the local IP address of your Apple TV and insert a working Plex token. Do this while the plex app is running in the foreground

<MediaContainer size="1">
<Player machineIdentifier="CENSORED" product="Plex for Apple TV" protocol="plex" deviceClass="stb" platform="tvOS" platformVersion="17.4" title="Apple TV" protocolCapabilities="playback,playqueues,timeline,provider-playback" protocolVersion="1"/>
</MediaContainer>

That's what my Apple TV outputs. We actually have pretty similar setups, I took am using Plex and PAS in docker and an Apple TV, and I do not have PAS on the host network and everything is working fine

When you aren't using HOST mode and you get errors, if you look at the Plex activity dashboard, is it showing the proper IP address of the client on that interface? I've seen if you have some kind of networking configuration problem in Plex, plex will just default to resolving the IP address to its own local IP which might be how you're getting the wrong client IP

@mdhiggins
Copy link
Owner

Also I may misinterpreted, but I do have my Plex container on the host network, just not Plex Auto Skip, but that still shouldn't make a difference functionality wise

@ryaneford
Copy link
Author

Also I may misinterpreted, but I do have my Plex container on the host network, just not Plex Auto Skip, but that still shouldn't make a difference functionality wise

you're the best thank you, i'll give this a shot and let you know

@mdhiggins
Copy link
Owner

Any updates or can I close this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants