How to Install, Configure and Run FlexGet

FlexGet is a multipurpose automation tool for content like torrents, NZBs, podcasts, comics, series, movies, etc, and can handle different kinds of sources like RSS feeds, HTML pages, and CSV files. This allows you to integrate and create powerful automation between your downloaders, organizers, and your media servers.

This guide shows you the following:

  1. Install Python 3 and FlexGet to your slot
  2. Create your first FlexGet configuration
  3. Running FlexGet
  4. Scheduling your FlexGet tasks
  5. Upgrading and Removing FlexGet

Please be sure to install Python 3.7 when the choice is offered by the python3 installation script as the script will offer multiple versions, Flexget requires 3.7 to function here at Ultra.

Installation of FlexGet via python's virtual environment

1. Installing Python 3 and FlexGet Into your Slot

  • First, log in to your seedbox's SSH
  • Run the following commands and follow the instructions. This will install Python 3 and FlexGet into your slot.

Python 3

bash <(wget -qO- https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/Language%20Installers/python-pip-install.sh)

FlexGet

bash <(wget -qO- https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/Flexget/flexget-install.sh)

Configuring FlexGet

Creating config.yml

  • Here, we will now create your first FlexGet YAML. Start by creating FlexGet's config folder by running the following command:
mkdir -p "$HOME"/.config/flexget
  • Navigate to your created folder by doing
cd "$HOME"/.config/flexget
  • Create a config.yml with the following
nano config.yml

To check if your 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 tracker ratio. To mitigate this, run flexget execute --learn. This will save the entries accepted so it won't download again in the future.

You may refer to FlexGet Configuration for more information about making your config as well as FlexGet Cookbook for some basic automation tasks that you can do with FlexGet.


Running FlexGet

Now, depending on your config, you can either run it using cron or FlexGet's daemon mode.

Cron

  • Type in your SSH window: which flexget. Take note of the output. This is the absolute path of FlexGet. Here, the absolute path is /homexx/username/bin/flexget
usbdocs@lw975:~$ which flexget
/home7/usbdocs/bin/flexget
usbdocs@lw975:~$
  • Then type crontab -e.
    • If this is your first time running this command, there would be an option asking for your text editor. Select the editor you want but I would suggest selecting 1.
  • To set it running every minute, you may set it as * * * * * then the absolute path of FlexGet, which is /homexx/username/bin/flexget. Then, add in the arguments of FlexGet which is --cron execute.
  • If we put it together, we get * * * * * /homexx/username/bin/flexget --cron execute

You may refer to Crontab Guru which is an quick and simple editor for cron schedule expressions.

  • If you don't want cron to message you whenever there's an error in FlexGet, append > /dev/null 2>&1 right after execute

  • Save your work with CTRL + O, press ENTER then CTRL + X

systemd/Daemon mode

For more information, please refer to FlexGet Scheduler.

  • Open up your FlexGet config and add the scheduler plugin before tasks

YAML config with Scheduler Plugin

schedules:
  - tasks: [list, of, tasks]
    schedule:
      minute: X
      hour: X
      day: X
      day_of_week: X
      week: X
      month: X
      year: X

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
  • Say you want to run test-1 at 22:05, 22:45, 23:05, 23:45 every day and test-2 every minute, you'll set it as it is below
    • Take note that the scheduler plugin also supports cron expressions.
schedules:
  - tasks: [test-1]
    schedule:
      minute: 5,45
      hour: 22,23
  - tasks: [test-2]
    interval:
      minute: 1

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
  test-2:
    rss:
      url: https://rss.to/any/s4h3rz-d1cz
      all_entries: no
    regexp:
      accept:
        - .*2160p.*
    deluge:
      host: 127.0.0.1
      port: 11123
      username: xan
      password: somepassword
      label: flexget
  • Save your work with CTRL + O, press ENTER then CTRL + X
  • Then navigate to /homexx/username/.config/systemd/user/ by typing cd /homexx/username/.config/systemd/user/
  • Create a service file (nano flexget-daemon.service) and add the following:
[Unit]
Description=FlexGet Daemon

[Service]
Type=simple
ExecStart=/homexx/xxxxx/bin/flexget daemon start
ExecStop=/homexx/xxxxx/bin/flexget daemon stop
ExecReload=/homexx/xxxxx/bin/flexget daemon reload

[Install]
WantedBy=default.target
  • Save your work with CTRL + O, press ENTER, then CTRL + X
  • Run systemctl --user daemon-reload
  • Run systemctl --user enable --now flexget-daemon.service to immediately start the daemon and to automatically restart whenever the daemon crashed or if there's a server restart
  • To check if the daemon is running, run flexget daemon status


Upgrading FlexGet

  • To upgrade FlexGet, just run the following command:
"$HOME"/flexget/bin/python -m pip install flexget --upgrade

Removing FlexGet

  • To remove FlexGet, delete the flexget folder and your symbolic link.
rm -rfv "$HOME"/flexget
rm "$HOME"/bin/flexget
  • If you also want to uninstall Python 3, run the following commands:
rm -rfv "$HOME"/.pyenv
  • Remove the following lines from .profile
export PATH="/homexx/username/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"