Wiki > Threadfin
Threadfin is an M3U proxy for Plex DVR and Jellyfin/Emby Live TV, based on xTeVe. It combines your M3U playlists and XMLTV guide data and presents them to your media server as an HDHomeRun tuner or as an M3U/XMLTV pair.
27541 was randomly generated for this article; you may use any 5-digit port between 10000 and 32767. Threadfin's default port, 34400, can't be used on Whatbox.
Create your Threadfin user in step 6 before you open Threadfin up in step 7. Until a user exists, whoever opens the web interface first can create one.
Installation
-
Connect to your slot via SSH.
-
Download Threadfin:
mkdir -p ~/bin && wget https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64 -O ~/bin/Threadfin_linux_amd64 && chmod +x ~/bin/Threadfin_linux_amd64 -
Create Threadfin's settings file in
~/.threadfin:~/bin/Threadfin_linux_amd64 -info -
Set your port, turn off network discovery (SSDP), keep Threadfin private to your slot for now, and turn on web authentication:
sed -i 's/"port": "34400",/"port": "27541",/' ~/.threadfin/settings.json sed -i 's/"ssdp": true,/"ssdp": false,/' ~/.threadfin/settings.json sed -i 's/"bindIpAddress": "[^"]*",/"bindIpAddress": "127.0.0.1",/' ~/.threadfin/settings.json sed -i 's/"authentication.web": false,/"authentication.web": true,/' ~/.threadfin/settings.json -
Start Threadfin:
screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64 -
Create your Threadfin user. You'll be asked for a username and a unique password (do not reuse your Whatbox password):
read -rp 'Username: ' tf_user; read -rsp 'Password: ' tf_pass; echo curl -s -o /dev/null --data-urlencode "username=$tf_user" --data-urlencode "password=$tf_pass" --data-urlencode "confirm=$tf_pass" http://127.0.0.1:27541/web/; unset tf_user tf_pass -
(Optional) If you plan to use HTTPS only, skip this step and set up HTTPS via Managed Links instead. Otherwise, make Threadfin reachable from outside your slot and restart it:
sed -i 's/"bindIpAddress": "127.0.0.1",/"bindIpAddress": "0.0.0.0",/' ~/.threadfin/settings.json pkill -fx "/home/user/bin/Threadfin_linux_amd64"; sleep 2; screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64 -
Visit http://server.whatbox.ca:27541/web/ (or your Managed Link address if you skipped step 7) and log in with the user from step 6.
Configuration
Threadfin doesn't have its own documentation yet; it follows xTeVe's documentation.
- Playlists and guide data: add your M3U playlists under Playlist and your XMLTV files under XMLTV, then map the channels you want under Mapping.
- Connecting Plex: in Plex, go to Settings → Live TV & DVR → Set up Plex DVR. If Plex doesn't find Threadfin, enter
server.whatbox.ca:27541as the tuner address. - Connecting Jellyfin or Emby: add a tuner of type M3U Tuner with
http://server.whatbox.ca:27541/m3u/threadfin.m3uand a guide provider of type XMLTV withhttp://server.whatbox.ca:27541/xmltv/threadfin.xml. The guide link only works once you've added XMLTV data and mapped channels. - Streaming: by default Threadfin sends players straight to the original stream and doesn't buffer it. Leave the buffer setting off unless a provider needs it; every stream Threadfin buffers counts toward your slot's traffic.
- Playlist and guide links: anyone with the address can download your M3U and XMLTV files. To require a login for them, enable M3U and XML authentication under Settings and give your media server the username and password in the link.
Automatically Restart (optional)
This script starts Threadfin if it isn't running, for example after the server reboots.
-
Create a restart script:
touch ~/threadfin_restart.cron nano -w ~/threadfin_restart.cron -
Paste in the following:
#!/bin/bash export TMPDIR=/home/user/.tmp if pgrep -fx "/home/user/bin/Threadfin_linux_amd64" > /dev/null then echo "Threadfin is running." else echo "Threadfin is not running, starting Threadfin" screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64 fi exitSave with
Ctrl + Sand exit withCtrl + X. -
Make the script executable:
chmod +x ~/threadfin_restart.cron -
Open your crontab:
EDITOR=nano crontab -e -
Add these lines, then save and exit:
@reboot /home/user/threadfin_restart.cron >/dev/null 2>&1 */5 * * * * /home/user/threadfin_restart.cron >/dev/null 2>&1
HTTPS via Managed Links (optional)
-
On the Manage Links page, click Add a custom app.
-
Name it
threadfin, enter port27541, and open Advanced options to enable WebSockets, which Threadfin's interface needs. -
Visit https://threadfin.example.box.ca/web/ and log in.
-
If you opened Threadfin up in step 7 of Installation and no longer need the plain HTTP port, make it private again and restart Threadfin:
sed -i 's/"bindIpAddress": "0.0.0.0",/"bindIpAddress": "127.0.0.1",/' ~/.threadfin/settings.json pkill -fx "/home/user/bin/Threadfin_linux_amd64"; sleep 2; screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64In your media server, use https://threadfin.example.box.ca/m3u/threadfin.m3u and https://threadfin.example.box.ca/xmltv/threadfin.xml.
Updating
Threadfin checks for a new version every time it starts and updates itself. To update, restart it:
pkill -fx "/home/user/bin/Threadfin_linux_amd64"; sleep 2; screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64
To update by hand instead, stop Threadfin with the pkill command above, repeat step 2 of Installation, then start it with step 5. Your settings in ~/.threadfin are kept.
Upgrading from the previous version of this article
Threadfin's binary and settings are in the same places as before, so your playlists and mappings are kept.
-
The previous instructions gave the port on the command line; the new start command reads it from the settings file. Check it with
grep '"port"' ~/.threadfin/settings.json. If it shows34400, set your port with the firstsedcommand from step 4 of Installation. -
The previous instructions started Threadfin open to everyone before a user was created. Make sure WEB Authentication is enabled under Settings and that you can log in.
-
Stop the copy started by the previous instructions, then start Threadfin the new way, which also updates it:
pkill -fx "/home/user/bin/Threadfin_linux_amd64 -port=.*"; sleep 2; screen -dmS threadfin /home/user/bin/Threadfin_linux_amd64 -
Set up the restart script if you want one.
Uninstalling
This deletes your playlists, mappings and settings.
-
Remove the two
threadfin_restart.cronlines from your crontab (EDITOR=nano crontab -e). -
Stop Threadfin and delete its files:
pkill -fx "/home/user/bin/Threadfin_linux_amd64" rm -rf ~/.threadfin ~/.tmp/threadfin rm -f ~/bin/Threadfin_linux_amd64 ~/threadfin_restart.cron -
If you set up a Managed Link, delete it from the Manage Links page.
Troubleshooting
- The page asks you to create a user instead of logging in: step 6 didn't work. Run it again, then reload the page.
- Threadfin says it's running on port 34400: the port wasn't set. Run the first
sedcommand from step 4 of Installation, then restart Threadfin. - The page doesn't load at http://server.whatbox.ca:27541/web/: check that
bindIpAddressin~/.threadfin/settings.jsonis0.0.0.0(step 7 of Installation);127.0.0.1only allows the Managed Link. Remember the/web/at the end of the address. - Forgot your Threadfin password: stop Threadfin, make it private with the
sedcommand from step 4 of HTTPS via Managed Links, delete the user file withrm ~/.threadfin/authentication.json, start Threadfin with step 5 of Installation, create a new user with step 6, then open it up again with step 7. - The restart script starts a second copy, or never starts Threadfin: check that both commands in
threadfin_restart.cronmatch the ones above exactly, including the full/home/user/bin/Threadfin_linux_amd64path. - Anything else: ask on Threadfin's Discord server, linked from its GitHub page.