-
Notifications
You must be signed in to change notification settings - Fork 106
Docker Walkthrough: Linux with config file
Rather than describe the general case and leave it to you to figure out how it applies to your situation, we will walk through a very specific setup, watch the system work, and then discuss how you can change it to match your specific situation.
The hope is to avoid common pitfalls and work through a setup known to work to try and head off possible problems and build some understanding.
I am assuming:
- You have Docker installed
- You have a basic familiarity with Docker concepts like containers and volume mapping.
To start, open a new terminal window or ssh to your linux server. You should be in your home directory, but to make sure you are, type cd ~
.
➜ ~ cd ~
Create a new directory and cd into it:
➜ ~ mkdir telly-docker
➜ ~ cd telly-docker
Download the config file template and open it in an editor.
The default editor in ubuntu is vi
. vi
is a very capable editor, but teaching it to you here is out of scope, so we'll use nano
. Let's first make sure that nano
is installed:
➜ telly-docker sudo apt install nano
Now download the example config file and open it in nano:
➜ telly-docker curl -fLO https://github.com/tellytv/telly/wiki/files/examples/telly.config.toml
➜ telly-docker nano telly.config.toml
The first thing we will change is the [Web] section; for purposes of this how-to, nothing above that needs to change.
Open a new terminal window and ssh into your server.
We need the local IP address of your linux machine. In your terminal, type ifconfig | grep "inet "
:
➜ telly-docker ifconfig | grep "inet "
inet 172.18.0.254 netmask 255.255.0.0 broadcast 172.18.255.255
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet 138.201.53.143 netmask 255.255.255.255 broadcast 0.0.0.0
inet 127.0.0.1 netmask 255.0.0.0
That 138.201.53.143
is the value we need [yours will probably be different]. Change the Base-Address
setting in the config file to match what was reported in your case:
[Web]
Base-Address = "138.201.53.143:6077" # Set this to the IP address of the machine telly runs on
Listen-Address = "0.0.0.0:6077" # this can stay as-is
In nano
, use the arrow keys to navigate, make the change, and hit control-O and return to save the file.
Next, configure a source. There are two options:
- A known named source, which as of this writing is one of: "Vaders", "area51", "Iris", OR "IPTV-EPG"
- Any source that provides an M3U URL [or file] and maybe an EPG XML URL [or file].
For purposes of this tutorial, I'll use an Iris account, but I'll configure it as a custom account since I'm expecting that everyone reading this has an iptv account that provides M3U and EPG links.
Delete all the Source blocks EXCEPT for the "Custom" source, and enter your M3U and EPG URLs. Comment out the four filter-related lines:
You can delete lines with nano by putting the cursor on the line and pressing control-K.
[[Source]]
Provider = "Custom"
M3U = "http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
EPG = "http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
# Filter = "Sports|Premium Movies|United States.*|USA"
# FilterKey = "group-title"
# FilterRaw = false
# Sort = "group-title"
I know it's tempting, but DO NOT change "Custom" to match your provider. "Custom" in this context is a magic word to telly. If you want to add an identifier, add a "Name" tag:
[[Source]]
Name = "Sooper Cool IPTV"
Save the file and go back to your terminal. In nano, control-x to exit. If you haven't saved, press "y" and return to save when asked.
There's a skeleton shell script to run telly in docker. This will allow us to make changes to the run command more easily than on the command line.
Download the shell script template and open it in nano.
➜ telly-docker curl -fLO https://github.com/tellytv/telly/wiki/files/examples/telly-docker.sh
➜ telly-docker nano telly-docker.sh
Edit the shell script to adjust the path /path/to/your/telly.config.toml
. Use the pwd
command to get the path you need:
➜ telly-docker pwd
/home/plex/telly-docker
I would replace /path/to/your/telly.config.toml
with /Users/plex/telly-docker/telly.config.toml
.
After:
#!/bin/sh
docker run -d \
--name='telly-test' \
-e TZ="America/Chicago" \
-p '6077:6077/tcp' \
-v /Users/plex/telly-docker/telly.config.toml:/etc/telly/telly.config.toml \
--restart unless-stopped \
tellytv/telly:dev
docker logs -f telly-test
Make sure that the shell script is executable:
➜ telly-docker chmod a+x telly-docker.sh
Now run that shell script:
➜ telly-docker ./telly-docker.sh
750693b91325bb9e3092002642ca04b5e7c7c3875f852d496491123e1bb7e116
time="2018-09-03T00:34:22Z" level=info msg="telly is preparing to go live (version=, branch=, revision=)"
time="2018-09-03T00:34:22Z" level=info msg="Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
time="2018-09-03T00:34:23Z" level=info msg="Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
time="2018-09-03T00:34:34Z" level=info msg="Loaded 9798 channels into the lineup from "
time="2018-09-03T00:34:34Z" level=panic msg="telly has loaded more than 420 channels (9798) into the lineup. Plex does not deal well with more than this amount and will more than likely hang when trying to fetch channels. You must use regular expressions to filter out channels. You can also start another Telly instance."
panic: (*logrus.Entry) (0xbc9da0,0xc4200920f0)
Hurray, our first error.
Plex has a limit of 420 channels; more than that result in unpredictable behavior. Because of this, telly will panic and exit if more than 420 channels are loaded.
That brings us to filtering.
It's impossible to come up with a generic solution for filtering. You're going to be applying a regular expression to portions of the lines in your M3U file to end up with just the channels you want. I'll go through an exercise here to filter my Iris channel list. You should be able to adapt what you see here easily.
Most IPTV providers split channels into "Groups"; "BRAZIL", "UK SPORTS", "Premium Movies", etc. So, an easy way to filter is by those group titles.
A channel in an M3U file will be identified with a line like this:
#EXTINF:-1 tvg-id="skysportsnews.uk" tvg-name="VIP Sky Sports News FHD" tvg-logo="http://picon.helixhosting.ninja/30950.png" group-title="UK VIP HD/FHD",VIP Sky Sports News FHD
That "group-title" is what we're interested in. So, we need a list of all the group-titles in the M3U so we can sort out which we want to keep.
Here's a terminal one-liner that will produce that list:
curl -fL "YOUR_M3U_URL" | sed 's/ \(group-title=".*"\),/\n\1\n/' | egrep -i -e "group-title" | sort | uniq
Copy that over to your text editor, replace YOUR_M3U_URL
with your M3U URL, and paste the whole thing into your terminal. You should see something like this:
➜ telly-docker curl -fL "http://irislinks.net:83/get.php?username=USER&password=PASS&type=m3u_plus&output=ts" | gsed 's/ \(group-title=".*"\),/\n\1\n/' | egrep -i -e "group-title" | sort | uniq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2077k 100 2077k 0 0 45232 0 0:00:47 0:00:47 --:--:-- 43858
group-title=""
group-title="2018 MOVIES"
group-title="24/7 ADULT CARTOONS"
group-title="24/7 KIDS MOVIES"
group-title="24/7 KIDS TV SHOWS"
group-title="24/7 LATIN CHANNELS"
group-title="24/7 LOCAL STREAMS [offline]"
group-title="24/7 MOVIES"
group-title="24/7 TV SHOWS"
group-title="ADULTS ONLY"
group-title="AFGHANISTAN"
... SNIP ...
group-title="SWITZERLAND / DENMARK"
group-title="THAILAND"
group-title="TOP COMEDY MOVIES"
group-title="TOP HORROR MOVIES"
group-title="TURKISH"
group-title="UK DOCUMENTARIES"
group-title="UK ENTERTAINMENT"
group-title="UK KIDS NETWORKS"
group-title="UK MOVIE NETWORKS"
group-title="UK NEWS NETWORKS"
group-title="UK SPORTS NETWORKS"
group-title="UK VIP HD/FHD"
group-title="UK VIP SD"
group-title="URBAN MOVIES"
group-title="USA & CANADA SPORTS"
group-title="USA ENTERTAINMENT"
group-title="USA KIDS NETWORKS"
group-title="USA LOCAL NETWORKS"
group-title="USA MOVIE NETWORKS"
group-title="USA NEWS NETWORKS"
group-title="USA VIP HD"
group-title="WRESTLING/MMA/BOXING REPLAY"
What does that command do? The
|
is called a "pipe", and it means "send the output from the previous command into the next command".
So, that command line will download the playlist, send it to a command that will put all the "group-title"s on lines of their own, then send that output to a command that will extract JUST those lines, then sort that list and show us just the unique ones.
Say we want to end up with:
- UK Sports
- All the movie networks
Back in the config file, I'm going to uncomment the filtering lines and modify them like this:
[[Source]]
Provider = "Custom"
M3U = "http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
EPG = "http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
Filter = "UK SPORTS|MOVIE NETWORKS"
FilterKey = "group-title"
FilterRaw = false
Sort = "group-title"
FilterKey
tells telly what field from the M3U line to look in.
That Filter
means "Look for channels where group-title contains 'MACEDONIA' OR 'LOCAL' OR 'UK SPORTS' OR 'USA'".
If FilerRaw
was true, That filter would be applied to the entire line, not just the group-title
.
This filter should pull in all the channels from:
group-title="UK MOVIE NETWORKS" because this group name contains "MOVIE NETWORKS"
group-title="UK SPORTS NETWORKS" because this group name contains "UK SPORTS"
group-title="USA MOVIE NETWORKS" because this group name contains "MOVIE NETWORKS"
Save the config file and run the shell script again.
➜ telly-docker ./telly-docker.sh
c9fa12f01949167fb43c015703c0cf0cb21875375492f3b84945eecbe27a24fd
time="2018-09-03T00:38:04Z" level=info msg="telly is preparing to go live (version=, branch=, revision=)"
time="2018-09-03T00:38:04Z" level=info msg="Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
time="2018-09-03T00:38:05Z" level=info msg="Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
time="2018-09-03T00:38:15Z" level=info msg="Loaded 120 channels into the lineup from "
time="2018-09-03T00:38:15Z" level=info msg="telly is live and on the air!"
time="2018-09-03T00:38:15Z" level=info msg="Broadcasting from http://0.0.0.0:6077/"
time="2018-09-03T00:38:15Z" level=info msg="EPG URL: http://0.0.0.0:6077/epg.xml"
Now those 9798 channels have been filtered down to 120.
This will be an iterative process for you to come up with the regex that includes all the channels you're interested in.
One place to learn more about regex is Regex One.
That's it; telly is running.
To verify this, open a new terminal window and request the default page from telly [or course, replace "192.168.1.61" with the appropriate address]:
➜ ~ curl http://138.201.53.143:6077
<root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><URLBase>http://138.201.53.143:6077</URLBase><device><deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType><friendlyName>HDHomerun (telly)</friendlyName><manufacturer>Silicondust</manufacturer><modelName>HDTC-2US</modelName><modelNumber>HDTC-2US</modelNumber><serialNumber></serialNumber><UDN>uuid:12345678</UDN></device></root>
Check the channel list by requesting the lineup:
➜ ~ curl http://138.201.53.143:6077/lineup.json
[{"GuideName":"UK At the races","GuideNumber":"10000","URL":"http://138.201.53.143:6077/auto/v10000"},{"GuideName":"UK BT SPORTS 1 SD","GuideNumber":"10001","URL":"http://138.201.53.143:6077/auto/v10001"},{"GuideName":"UK BT SPORTS 2 FHD","GuideNumber":"10002","HD":1,"URL":"http://138.201.53.143:6077/auto/v10002"},{"GuideName":"UK BT SPORTS 2 HD","GuideNumber":"10003","HD":1,"URL":"http://138.201.53.143:6
**REMAINDER CLIPPED**
That will produce a lot of JSON output, but as you scroll through you should recognize your channel names.
You should now be able to move on to adding the Telly Virtual DVR to Plex.
- Overview
- Standard Configuration
- Unusual Configurations
- Windows Service
- Linux Autostart
- Logs
- TVHeadend with 1.1