Plex Live TV Channels M3U?

Weird issue tonight @joagomez ... a big chunk of Plex guide data in the middle of my channels has stopped loading and won't load even when trying to refresh the info... any ideas? Here's what it looks like:

What do the docker logs say?

Just guessing here as the time is about 0:00 UTC time that you are missing data for the channels is that there was an error loading the data for 4-16 UTC (Plex uses UTC) and did not complete. I would assume that would completed on the next pull of data. I may need to put an option to force a repull from Plex as well to complete when this happens

1 Like

That seems to be maybe what happened... the next pull of data, and it's all back to normal with full guide info.

I think I have a Gracenote ID for one of the Plex channels that isn't in the Docker's Gracenote=include list. Hopefully this is the right place to post it.

FamilyTime seems to match 1:1 with Gracenote ID 127467

I hope this helps!

I'm running the latest version of @jaogomez's plex-for-channels docker (v1.09), and lost all my channels this morning...

I restarted the container, and tailed the docker log.. received this when trying to access the m3u:

[2024-05-22 20:34:47,445] ERROR in app: Exception on /plex/local/playlist.m3u [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/pywsgi.py", line 105, in playlist
    tmsid_stations = list(filter(lambda d: d.get('tmsid'), stations))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable

Is this a configuation issue on my end, or has something changed on the backend of Plex? Is anybody else having a problem?

Thanks in advance...

I was not having this problem but decided to rebuild my container just in case. and again no problems so seems like an issue with your container??

This does indicate I forgot an error check condition as it appears your container is having a problem pulling the station data, thus the NoneType

1 Like

I removed the container and the image and reinstalled it, and the issue persisted. Might I have an issue with my config?

This is what I did to reinstall it:

docker stop plex-for-channels
docker remove plex-for-channels
img=`docker images | grep plex-for-channels | tr -s ' ' | cut -d ' ' -f 3'
docker rmi -f $img
docker run -d --restart unless-stopped -p 8177:7777 -e PLEX_CODE=us_west --name plex-for-channels ghcr.io/jgomez177/plex-for-channels

I also deleted my source configuration in channels and recreated it under a different source name to see if there was something corrupt in the configuration within channels causing this. Same behavior, and because there was no .m3u provided back to channels, it will not add the source.

i updated the docker to add more error handling. This may give more insight into the issue

2 Likes

while error handling is good, in this case there's less information to be had... now, the docker log shows nothing and Channels will not add the channel, but pops up the following error:

##### invalid source url: Get "http://100.76.165.112:8177/plex/us_west/playlist.m3u": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

So, there is a change in behavior, but it doesn't look like it provides much assistance.

I'm no Docker expert, but have decades of (9+ year old) IT experience... is there anything I can do to assist you in debugging?

1 Like

Seems like a network issue. Is that IP correct?

Can you please confirm that the log is completely empty?
If so, I believe the PLEX_CODE variable you entered is not valid.
Uploading another version with more error handling.
Allowed for PLEX_CODE variables to be case-insensitive

It is... I can connect to the html interface in the docker container via that address from my channels server (using wget at the commandline)...

It is a private VPN address from my Tailscale network that I'm using for all my channels clients.

The PLEX_CODE is 'us_west'.

This is what appears in the Docker logs upon restarting the container:

2024-05-24T01:15:41.911552067Z Initialize XML File
2024-05-24T01:15:41.911609267Z Run channels to load self.channel_list
2024-05-24T01:16:01.979347018Z Exception type Error: ConnectionError
2024-05-24T01:16:01.980064833Z ⇨ http server started on [::]:7777

Nothing appears in the Docker log when attempting to add a new source to Channels. The error shown in Channels is:

invalid source url: Get "http://100.76.165.112:8177/plex/us_west/playlist.m3u": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

When I try to access the m3u file in a browser:

Exception type Error: ConnectionError

Which I believe is the new error handling you just added...

When I try to access the EPG data in a browser, I get:

XML file not found

The main HTML page loads fine (pasted in a code block here, so not HTML formatted):

# Plex Playlist v1.10a

Last Updated: May 23, 2024

* PLEX US_WEST: http://100.76.165.112:8177/plex/us_west/playlist.m3u
* PLEX US_WEST MJH Compatible: http://100.76.165.112:8177/mjh_compatible/plex/us_west/playlist.m3u
* PLEX US_WEST Gracenote Playlist: http://100.76.165.112:8177/plex/us_west/playlist.m3u?gracenote=include
* PLEX US_WEST EPG Only Playlist: http://100.76.165.112:8177/plex/us_west/playlist.m3u?gracenote=exclude

* PLEX US_WEST EPG: http://100.76.165.112:8177/plex/epg/us_west/epg-us_west.xml
* PLEX US_WEST EPG GZ: http://100.76.165.112:8177/plex/epg/us_west/epg-us_west.xml.gz

Aman questioned if it was a local networking issue, so I also tried everything on the local network address instead of my Tailscale VPN (as shown in these logs), and it ended with the same results...

I'll update to the latest image and let you know.

I did already upgrade to the latest image... I verified via the sha256 digest

Digest: sha256:b86079ad7c7d1d66fd0b2686afb30f68ae3bf5aeace1a35e261a592457e6d2f5
Status: Downloaded newer image for ghcr.io/jgomez177/plex-for-channels:latest

Apparently, pywsgi.py didn't get the version update in the code:

monkey.patch_all()

version = "1.10a"     <--------------------------------- (should be 1.10b)
updated_date = "May 23, 2024"

port = os.environ.get("PLEX_PORT")


I just decided to try to break it more to see if I could get more data for you... :grinning:

It's something I'm quite practiced at -- I've been doing it since the 70s when I crashed the mainframe system at my father's work... :joy:

I attempted to access the channels.json data in my browser and the Docker logs threw:

2024-05-24T01:45:50.277728210Z Initialize XML File
2024-05-24T01:45:50.277886891Z Run channels to load self.channel_list
2024-05-24T01:46:10.394998533Z Exception type Error: ConnectionError
2024-05-24T01:46:10.395026505Z ⇨ http server started on [::]:7777
2024-05-24T01:48:19.919735431Z [2024-05-24 01:48:19,918] ERROR in app: Exception on /plex/local/channels.json [GET]
2024-05-24T01:48:19.919770530Z Traceback (most recent call last):
2024-05-24T01:48:19.919775515Z   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
2024-05-24T01:48:19.919779768Z     response = self.full_dispatch_request()
2024-05-24T01:48:19.919783516Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-24T01:48:19.919787250Z   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 883, in full_dispatch_request
2024-05-24T01:48:19.919791249Z     return self.finalize_request(rv)
2024-05-24T01:48:19.919794907Z            ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-24T01:48:19.919798517Z   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 902, in finalize_request
2024-05-24T01:48:19.919802384Z     response = self.make_response(rv)
2024-05-24T01:48:19.919805928Z                ^^^^^^^^^^^^^^^^^^^^^^
2024-05-24T01:48:19.919809637Z   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1174, in make_response
2024-05-24T01:48:19.919813468Z     raise TypeError(
2024-05-24T01:48:19.919817130Z TypeError: The view function for 'channels_json' did not return a valid response. The function either returned None or ended without a return statement.

while the browser only returned:

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Maybe this will help to isolate the issue (or, hopefully not, I've found another issue)...

Also -- I was looking at the code and tested my network connectivity to the plex.tv API from my channels server -- and there isn't a connectivity issue. I called the API's /api/v2/users/anonymous
with snippets I copied out of plex.py, and received back a status code 201, and a nice, pretty block of json code: (truncated - it's too long to post, and not interesting enough after what I've snipped out here)

{
    "id": 369376060,
    "uuid": "x1x9x4x3x5x8x6xc",<--------- I obfuscated this -- not sure if I should post it
    "username": "",
    "title": "",
    "email": "",
    "friendlyName": "",
    "locale": null,
    "confirmed": false,
    "joinedAt": 1716516520,
    "emailOnlyAuth": false,
    "hasPassword": true,
    "protected": false,
    "thumb": "https://plex.tv/users/e1a98483d508967c/avatar?c=1716516520",
    "authToken": "aXkXQXFXMXTX7XyXQXCX",    <--------- I obfuscated this -- not sure if I should post it

I would agree with @tmm1 at this point, the connection error means you are not reaching the plex api server, either result from dns issues or other network issues.

1 Like

Just plugging into Chrome, I get (without a VPN)

This site can’t be reached

100.76.165.112 refused to connect.

Try:

ERR_CONNECTION_REFUSED

With my VPN active...

This site can’t be reached

100.76.165.112 took too long to respond.

Try:

ERR_CONNECTION_TIMED_OUT

Maybe the site has been flagged for a capacity/request violation by their provider?

No -- YOU cannot access it -- this is one of MY private VPN addresses, internal access only.

1 Like

Sorry....must have missed that.

oops -- please see the edit I just made to my previous post... I just tested connectivity to the plex API from my Channels server (where I am running Docker).

Trying to test from inside the Docker container now...

So... getting somewhere: I cannot access clients.plex.tv from inside the container -- the name will not resolve:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='clients.plex.tv', port=443): Max retries exceeded with url: /api/v2/users/anonymous?X-Plex-Product=Plex+Web&X-Plex-Version=4.126.1&X-Plex-Client-Identifier=8d8bab25dfeb6f9901d70c66&X-Plex-Language=en&X-Plex-Platform=Chrome&X-Plex-Platform-Version=123.0&X-Plex-Features=external-media%2Cindirect-media%2Chub-style-list&X-Plex-Model=hosted&X-Plex-Device=Linux&X-Plex-Device-Name=Chrome&X-Plex-Device-Screen-Resolution=1282x929%2C1920x1080 (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f671cc60e30>: Failed to resolve 'clients.plex.tv' ([Errno -3] Temporary failure in name resolution)"))

So there must be a misconfiguation in Docker somehow... but my other containers appear to be working fine... I'll try installing the container on a different Docker server I have running to confirm that it is ME and then I'll report back...