Here's a How-To get the above Bash Shell Scripts (PlexIPTV.sh and plextoken.sh) up and running for Channels-dvr running in an existing fancybits/channels-dvr Docker Container. I already have a long Docker to-do list with all my other HomeLab Containers, so I was keen to get this up and running in the bare minimum number of steps just using the current channels-dvr Docker Container. Basic steps are:
-
Figure out what Host folder has already been mapped to your Channels-dvr Container from the Container's script (or alternatively use your own location BUT then you pick up add'l steps for mapping it to the Container). For the fancybits Container, that location is: /mnt/disk/dvr/
-
Manually (as root) create the ../iptv subfolders that the Bash Scripts intended to create in your (default Linux install) Home folder but do so in said (default Container install) Host subfolder location already accessible to the fancybits Container. (Or alternatively, as mentioned above, pick your own location, including the Home location in the Script, but then you pick up the work of setting up and maintaining the mapping of that location to the Container.) Set appropriate Permissions for those specific newly created subfolders (i.e., so the Scripts can be run as non-root, and the Results can be read by the Channels-dvr Container).
For example, whereas the plextoken.sh Script wants to create a certain additional folders in the (default Linux install) ~/channels-dvr folder:
$ mkdir -p ~/channels-dvr/iptv/plex
Instead, create these in a location where the fancybits Container already thinks its /channels-dvr folder is located:
$ sudo mkdir -p /mnt/disk/dvr/config/iptv/plex
- Patch the Bash Scripts to use the New Host Container folder location (above, or one you created/mapped) instead of the Home folder location that the Container cannot access.
For example, Replace the string:
~/channels-dvr/iptv/plex
With:
/mnt/disk/dvr/config/iptv/plex
Obviously some of the Code can now instead simply be commented out (e.g, mkdir call).
-
Run (+/- further debug/edit, as necessary) plextoken.sh Script to obtain Plex token. Unfortunately for me, 90% of my time here was spent on this step so I will elaborate to help others avoid my particular problem. The plextoken.sh Script (at the time of this posting) bombs on a '%' char in the password (regardless of how you Quote it). I therefore had to feed that Script a URL Encoded version of my password so that the Script could correctly use it as part of a URL that it ultimately sends (cleartext btw) to the Plex token server. Prior comments above elaborate on this issue. Simple non-techie solution is to just have a Password with only URL-friendly chars (e.g., Mixed-case alphanumeric). Once the correct token file is generated, you are good to go running the PlexIPTV.sh Script.
-
Create your “Plex” Source in Channels-dvr WebUI (as previously shown above). The Container can access the .m3u8 and .xml files directly from the Host File System simply using File syntax.
File | Source:
/channels-dvr/iptv/plex/us.m3u8
XMLTV Guide Data:
file:///channels-dvr/iptv/plex/us.xml
Edit: To the extent channels-dvr needs to access the XML file via HTTP protocol, I run the (built-in) Python HTTP.Server at an arbitrary Port (e.g., 8095) and feed the XMLTV Guide Data text field the URL of the Host IP (e.g., 192.168.1.99) and XML:
python3 -m http.server 8095 &
XMLTV Guide Data:
http://192.168.1.99:8095:/us.xml
BTW, any old pre-existing broken Plex Source must be either deleted or de-prioritized before you can access the individual Channels from your new working Plex Source.
- Create a user Cron job to periodically run PlexIPTV.sh, for refreshing .m3mu and .xml files.
Enjoy. The Bash Scripts nicely remove a nagging thorn from using Plex Live TV feeds. !!!BIG THANKS!!! to John9527 for creating them.