Skip to content

Threadfin

slunat edited this page Mar 6, 2024 · 2 revisions

Threadfin is a M3U proxy that can spoof a HDHomeRun device, allowing it to be added to PLex/Jellyfin/Emby as a live tv tuner. This allows you to do something like pass through an IPTV subscription to Plex to have your channels available within Plex.

Installation

Create an unprivileged container with the below specifications.

  • Template: Debian 12 (Bookworm)
  • CPU: 1
  • Memory: 512MB
  • Disk: 2GB

Preperation

  1. Boot the container and run the command apt-get update && apt-get upgrade -y to get everything updated
  2. Run apt install screen to install screen. We will use this to run Threadfin inside a virtual terminal.
  3. Open a browser and go to the Threadfin Releases page to see the latest release. Right click on the release you require and copy link. In this example we will use v1.0.24-linux-amd64 which has the link https://github.com/Threadfin/Threadfin/releases/download/1.0.24/Threadfin_linux_amd64
  4. We will now pull the files for Threadfin. In the terminal, enter the command wget https://github.com/Threadfin/Threadfin/releases/download/1.0.24/Threadfin_linux_amd64. Make sure the url you use is the one you got in step 3.
  5. The threadfin file should now have been downloaded to your root directory. We need to make it executable, so run the command chmod u+x ./Threadfin_linux_amd64
  6. If you do not yet know what the IP address is of your container, you can find out by running ip address. It is highly recommend to either configure a static IP address or set a DHCP reservation for this container so it maintains the same IP address all the time. If your IP changes, you will need to reconfigure your media server to point to the new IP address, so its best if the container keeps the same IP at all times to avoid the extra maintenance. I would recommend doing it at this stage before continuing further.

First Run

  1. Now that we have got the files, we want to start the server. This is best to do in a screen session just so you can work on your container without disrupting the server. TO do this, run the command screen -S threadfin. This will create a new screen session called "threadfin".
  2. Now we are in the screen session, run ./Threadfin_linux_amd64 to start the threadfin server. You can now access the Threadfin UI via a browser by going to http://[your container ip]:33400.
  3. Configure your proxy as required using the documentation here.

Setup Autorun

  1. We will now set the script to automatically start when the container boots up. First we will need to exit the screen session to return to the normal terminal, which you can do by pressing ctrl + a, followed by d. You can return to your threadfin screen at any time by entering screen -r threadfin
  2. Next we will create a directory to hold our script. Enter mkdir scripts
  3. Now we will create and edit the script itself. Enter nano scripts/threadfin.sh
  4. In the editor, enter the below three lines. This will start a screen session called "threadfin" in the background and start the server inside of it.

#!/bin/bash

screen -dmS threadfin

./Threadfin_linux_amd64

  1. Press ctrl + x, then y to save your changes to the file.
  2. Now we need to make the script executable. Enter chmod +x scripts/threadfin.sh
  3. Now the script is setup, we need to set it to automatically run on boot. TO do this, we will edit the crontab file by entering crontab -e. Enter option 1 when prompted for an editor to use.
  4. In the bottom of the crontab file, add the line @reboot scripts/threadfin.sh

Updating Components

Threadfin

  1. To update Threadfin, first kill the existing running session. Since this is running in a screen, you just need to enter screen -k threadfin
  2. Next, rename the current threadfin file by running mv Threadfin_linux_amd64 Threadfin_linux_amd64old. If you'd prefer, you can also just remove the file by entering rm Threadfin_linux_amd64, but renaming allows you to easily rollback if you need to so I would suggest renaming for now and deleting once you are happy with the new version.
  3. Next, we need to get the link to the new release. You can do this by opening a browser and going to the Threadfin Releases page to see the latest release. Right click on the release you require and copy link. In this example we will use v1.0.24-linux-amd64 which has the link https://github.com/Threadfin/Threadfin/releases/download/1.0.24/Threadfin_linux_amd64
  4. We will now pull the files for Threadfin. In the terminal, enter the command wget https://github.com/Threadfin/Threadfin/releases/download/1.0.24/Threadfin_linux_amd64.
  5. You now need to make the script executable by running chmod u+x ./Threadfin_linux_amd64
  6. Reboot your container and your Threadfin should now be up and running on the new version.