Skip to main content

How to Install, Configure and Run Flexget

Quick Reference

####PIP3 and Flexget Installation####
 
mkdir -p '.local/bin'
python3 <(curl https://bootstrap.pypa.io/get-pip.py) --user && pip3 install --user flexget
 
####change PATH="$HOME/bin:$PATH" to PATH="$HOME/bin:$HOME/.local/bin:$PATH" in .profile#####
####Configuration of Flexget (it uses YAML)####
 
mkdir '.config/flexget'
cd .config/flexget
nano/vim config.yml ####after editing config.yaml####
 
flexget check
flexget --test execute
 
####Running Flexget####
 
cron: (add own cron expressions here) /homexx/xxx/.local/bin/flexget --cron execute
 
daemon mode:
 
add schedules plugin as top level plugin
Create systemd service
 
####flexget-daemon.service start####
[Unit]
Description=Flexget Daemon
After=network.target
 
[Service]
Type=simple
ExecStart=/homexx/xxxxx/.local/bin/flexget daemon start
ExecStop=/homexx/xxxxx/.local/bin/flexget daemon stop
ExecReload=/homexx/xxxxx/.local/bin/flexget daemon reload
 
[Install]
WantedBy=default.target
####flexget-daemon.service end####
 
systemctl --user daemon-reload && systemctl --user enable --now flexget-daemon.service

Introduction

FlexGet is a multi-purpose automation tool for content like torrents, NZBS, podcasts, comics, series, movies, etc and is able to handle different kinds of sources like RSS feeds, HTML pages and CSV files.

Installation of PIP3 and Flexget

  • Login to your box via SSH.
  • Create a folder in your slot with mkdir -p '.local/bin'. This is important because this is where PIP and subsequently any other python apps will be installed.
  • Now, we will install PIP
  • Do the following command to download PIP: python3 <(curl https://bootstrap.pypa.io/get-pip.py) --user
  • Then open up .profile using your preferred text editor (either nano .profile or vim .profile). In this example, we will use nano.

image2019-4-23_7-7-24[1].png

  • Navigate to the bottom of the file then change PATH="$HOME/bin:$PATH" to PATH="$HOME/bin:$HOME/.local/bin:$PATH"

image2019-4-23_7-33-32[1].png

  • Save the file with CTRL + O then press Enter. Force refresh .profile by typing source .profile. Confirm that you configured it correctly by entering which pip3. It should give you the absolute path of your pip3 installation.

image2019-4-23_7-20-48[1].png

  • After that, pip3 install --user flexget (In the screenshot, you can see that most of the prerequisites are already satisfied. That's because during this time of writing I already installed flexget. For first time installation tho, you should see progress bars of each prerequisites.)

image2019-4-23_7-22-28[1].png

  • To check if you installed it correctly, type flexget

image2019-3-24_1-44-42[1].png

Configuring Flexget

  • Create a folder with mkdir '.config/flexget'
  • Navigate to it with cd .config/flexget
  • Open up your fave text editor with nano config.yml

In this part, depending on what you want to achieve your configuration may vary but take note that:

  • Flexget config uses YAML. Indentation and spacing is critical so take care when writing your config.
  • YAML uses spaces, not tabs.

For this example, I'll be configuring flexget to monitor RSS feeds every minute and filters out the results using regex I set. Those that are accepted in my regex will be fed directly to deluge for it to download. The config is shown below.

# Example YAML Config

tasks:
  test-1:
    rss:
      url: https://rss.to/any/f4lt3r-h4h4
      all_entries: no
    regexp:
      accept:
        - .*1080p.*
    deluge:
      host: 127.0.0.1
      port: 11123
      username: xan
      password: somepassword
      label: flexget
# YAML config with explanation

tasks: # A flexget config's main component are tasks, so we start here.
  test-1: # This is the first task. Here, we name our first task "test-1"
 
# Now, we will now add plugins. There are three main types of plugins we normally want in a task in order: an input, a  filter, and an output.
 
    rss: # This is an example of an input plugin, the first one to run in a task. This tells flexget where do you want it to look for things. In this example, we tell to look into rss feeds.
      url: https://rss.to/any/f4lt3r-h4h4
      all_entries: no # This entry tells flexget to have each entry only created on the first run it is seen.
 
    regexp: # This is an example of a filter plugin. This tells flexget which of the entries the input plugin has that you want. Here, we're using the regexp plugin to filter out entries that you want using regex.
      accept:
        - .*1080p.* # Here, we tell flexget to accept all torrents with the word 1080p in it.
 
# TL;DR regex I used is .*, which matches any characters, including line breaks. I added it in the start and the end of 1080p.
# You may refer to https://regexr.com/ to help you learn and build your own regex.
 
    deluge: # This is an output plugin. This is to tell flexget what do with those things you want. Here, I want to use Deluge as my torrent client. Before I run this tho, I need to install another instance of deluge for flexget by running pip3 install --user deluge-client. You'll only need this to communicate to your actual Deluge installation (The one you installed via UCP). Your preferred torrent client's setup may vary so you may look up to flexget's wiki for that.
      host: 127.0.0.1
      port: 11123
      username: xan
      password: somepassword
      label: flexget

After that, save your work with CTRL + O, press ENTER then CTRL + X.

To check if you config is correctly formatted and configured, you may have to do the following commands:

  • flexget check to check the config file for any errors
  • flexget --test execute to test run your configuration.

In my example, when you run it the first time, it may grab and download multiple torrents which may affect your ratio. To save the headache:

1. Remove the output plugins from your config
2. Run flexget execute
3. After it finishes put back the output plugins.

This will save the entries accepted so it won't download again in the future.