Skip to content

Standalone Walkthrough: Linux with config file

Chaz Larson edited this page Aug 6, 2019 · 18 revisions

ATTENTION: This walkthrough is specific to the version being shown below, which, as of this writing, is 1.1.0-Beta6. If you try to go through this walkthrough, but substitute some other version, it probably will not work. If you're going through this walkthrough, you should perhaps copy-paste the commands below. Do not substitute what you think may be the "latest version" here.

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.

To start, open a new terminal window. 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-tutorial && cd telly-tutorial

Download the latest release:

➜  telly-tutorial curl -fLO https://github.com/tellytv/telly/releases/download/1.1.0.6/telly-1.1.0.6.linux-amd64.tar.gz

Uncompress the archive and cd into the new directory:

➜  telly-tutorial tar -xvf telly-1.1.0.6.linux-amd64.tar.gz
x telly-1.1.0.6.linux-amd64/
x telly-1.1.0.6.linux-amd64/LICENSE
x telly-1.1.0.6.linux-amd64/NOTICE
x telly-1.1.0.6.linux-amd64/telly
➜  telly-tutorial cd telly-1.1.0.6.linux-amd64
➜  telly-1.1.0.6.linux-amd64

And run telly with the -h flag to show the help:

➜  telly-1.1.0.6.linux-amd64 ./telly -h
Usage of ./telly:
  -c, --config.file string          Path to your config file. If not set, configuration is searched for in the current working directory, $HOME/.telly/ and /etc/telly/. If provided, it will override all other arguments and environment variables. $(TELLY_CONFIG_FILE)
      --log.level string            Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] $(TELLY_LOG_LEVEL) (default "info")
      --log.requests                Log HTTP requests $(TELLY_LOG_REQUESTS)
      --version                     Show application version
  -b, --web.base-address string     The address to expose via discovery. Useful with reverse proxy $(TELLY_WEB_BASE_ADDRESS) (default "localhost:6077")
  -l, --web.listen-address string   Address to listen on for web interface and telemetry $(TELLY_WEB_LISTEN_ADDRESS) (default "localhost:6077")
pflag: help requested

Note: telly will often produce more output than will be shown here; typically the material not shown here will be error messages that would only serve as clutter in this context.

There are only a few flags, but the best practice is to leave all the configuration in the config file; everything config-related can and should be set via the config file [except, of course, the location of the config file].

Step one is to create a config file.

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-1.1.0.6.linux-amd64 sudo apt install nano

Now download the example config file and open it in nano:

➜  telly-1.1.0.6.linux-amd64 curl -fLO https://github.com/tellytv/telly/wiki/files/examples/telly.config.toml
➜  telly-1.1.0.6.linux-amd64 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-1.1.0.6.linux-amd64 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:

  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.

Run telly. You should see something like this:

➜  telly-1.1.0.6.linux-amd64 ./telly
INFO[2018-08-30T20:34:02-05:00] telly is preparing to go live (version=1.1.0.6, branch=dev, revision=f1de7f04430f9f6d35ad7caf55d4d5360a1d681c)
INFO[2018-08-30T20:34:02-05:00] Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts
INFO[2018-08-30T20:34:46-05:00] Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED
INFO[2018-08-30T20:41:50-05:00] Loaded 9881 channels into the lineup from
PANI[2018-08-30T20:41:50-05:00] telly has loaded more than 420 channels (9881) 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) (0x17cc520,0xc420296140)

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-1.1.0.6.linux-amd64 curl -fL "http://irislinks.net:83/get.php?username=USER&password=PASS&type=m3u_plus&output=ts" | sed '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 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 telly again:

➜  telly-1.1.0.6.linux-amd64 ./telly
INFO[2018-08-31T12:54:07-05:00] telly is preparing to go live (version=1.1.0.6, branch=dev, revision=f1de7f04430f9f6d35ad7caf55d4d5360a1d681c)
INFO[2018-08-31T12:54:07-05:00] Loading M3U from http://irislinks.net:83/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=ts
INFO[2018-08-31T12:54:08-05:00] Loading XMLTV from http://irislinks.net:83/xmltv.php?username=REDACTED&password=REDACTED
INFO[2018-08-31T12:54:29-05:00] Loaded 126 channels into the lineup from
INFO[2018-08-31T12:54:29-05:00] telly is live and on the air!
INFO[2018-08-31T12:54:29-05:00] Broadcasting from http://0.0.0.0:6077/
INFO[2018-08-31T12:54:29-05:00] EPG URL: http://0.0.0.0:6077/epg.xml

Now those 9881 channels have been filtered down to 126.

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://192.168.1.61:6077
<root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><URLBase>http://192.168.1.61: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://192.168.1.61:6077/lineup.json
[{"GuideName":"UK At the races","GuideNumber":"10000","URL":"http://192.168.1.61:6077/auto/v10000"},{"GuideName":"UK BT SPORTS 1 SD","GuideNumber":"10001","URL":"http://192.168.1.61:6077/auto/v10001"},{"GuideName":"UK BT SPORTS 2 FHD","GuideNumber":"10002","HD":1,"URL":"http://192.168.1.61:6077/auto/v10002"},{"GuideName":"UK BT SPORTS 2 HD","GuideNumber":"10003","HD":1,"URL":"http://192.168.1.61: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.

As an example, that "Custom" source we just created could be created as a named "Iris" source like this:

[[Source]]
  Provider = "Iris"
  Username = "YOUR_IRIS_USERNAME"
  Password = "YOUR_IRIS_PASSWORD"
  Filter = "UK SPORTS|MOVIE NETWORKS"
  FilterKey = "group-title"
  FilterRaw = false
  Sort = "group-title"
Clone this wiki locally