Skip to content

Docker Walkthrough: Linux with config file

Chaz Larson edited this page Jun 21, 2019 · 12 revisions

Please follow this walkthrough exactly as written. Don't put files in alternate locations or do things differently to how they are described here until you've seen it work and have an understanding of WHY things work the way they do. This walkthrough has been followed successfully many many times on several different setups. The screenshots and output samples were all captured while running through it. It works as written. Please follow it at least the first time through for the best chance of success.

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:

  1. You have Docker installed
  2. 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 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:

  1. A known named source, which as of this writing is one of: "area51", "Iris", OR "IPTV-EPG"
  2. Any source that provides an M3UPLUS 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 M3UPLUS and EPG links.

Make sure that you are using an M3UPLUS file or link, not an M3U.

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 = "YOUR_FILTER_REGULAR_EXPRESSION"
#  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.

➜  telly-docker curl -fLO https://github.com/tellytv/telly/wiki/files/examples/telly-docker.sh

Make sure that the shell script is executable:

➜  telly-docker chmod a+x telly-docker.sh

This shell script will work without modification IF your config file is in the same directory as the script [this is true if you've been following this walkthrough].

Now run that shell script:

➜  telly-docker ./telly-docker.sh
750693b91325bb9e3092002642ca04b5e7c7c3875f852d496491123e1bb7e116
time="2019-06-13T22:29:33Z" level=info msg="telly is preparing to go live (version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6)"
time="2019-06-13T22:29:33Z" level=info msg="Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
time="2019-06-13T22:29:42Z" level=info msg="Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
time="2019-06-13T22:30:12Z" level=info msg="Loaded 9798 channels into the lineup from "
time="2019-06-13T22:30:12Z" 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 [and the default] 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:

  1. UK Sports
  2. 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 'UK SPORTS' OR 'MOVIE NETWORKS'". If FilterRaw 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:

the group "UK MOVIE NETWORKS" because this group name contains "MOVIE NETWORKS"
the group "UK SPORTS NETWORKS" because this group name contains "UK SPORTS"
the group "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="2019-06-13T22:29:33Z" level=info msg="telly is preparing to go live (version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6)"
time="2019-06-13T22:29:33Z" level=info msg="Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts"
time="2019-06-13T22:29:42Z" level=info msg="Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED"
time="2019-06-13T22:30:12Z" level=info msg="Loaded 120 channels into the lineup from Iris"
time="2019-06-13T22:30:12Z" level=info msg="telly is live and on the air!"
time="2019-06-13T22:30:12Z" level=info msg="Broadcasting from http://0.0.0.0:6077/"
time="2019-06-13T22:30:12Z" 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. There is more discussion of filtering here.

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 the IP in the example 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 add telly to Plex.

There are some scripts that automate some of this here. I know, a config file that generates another config file. TELLYCEPTION

Clone this wiki locally
You can’t perform that action at this time.