How to Install, Configure and Run FlexGet
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. This allows you to integrate and create powerful automation between your downloaders, organizers and your media servers.
This guide shows you the following:
- Install Python 3 and FlexGet to your seedbox slot
- Create your first FlexGet configuration
- Running FlexGet
- Scheduling your FlexGet tasks
- Upgrading and Removing FlexGet
Installation of Flexget via python's virtual environment
Installing Python 3 and Flexget Into your Slot
- First, login to your seedbox's SSH
- For more information on how to access your seedbox's SSH, visit this guide to learn more.
- Run the following commands and follow the instructions. This will install Python 3 and Flexget into your slot.
Python 3
wget https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/Language%20Installers/python-pip-install.sh
bash python-pip-install.sh
Flexget
wget https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/Flexget/flexget-install.sh
bash 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
cd "$HOME"/.config/flexget
- Create a config.yml with the following
nano config.yml
Editing 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'we'll be configuring FlexGet to monitor RSS feeds every minute and filters out the results using regexRegular IExpressions set.(regex). Those that are accepted in my regex will be fed directly to delugeDeluge 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 name of 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
# Here, you'll add your RSS link
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 torrentsentries with the wordterm 1080p in it.the title.
# TL;DRThe regex Iused usedhere is .*, which matchestells to match any characters, including line breaks. I added it in the start and the end of 1080p.whitespaces.
# 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 is used as mythe torrent client. Before Irunning, runyou this tho, Imay need to install anotheran separate instance of deluge for FlexGet by running the following command
# "$HOME"/flexget/bin/python -m pip install 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,O, press ENTER then CTRL + X.X.
To check if youyour config is correctly formatted and configured, you may have to do the following commands:
flexget check
to check the config file for any errorsflexget --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:
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.
You may refer to FlexGet Configuration for more information about making your own config as well as FlexGet Cookbook for some of the basic automation tasks that you can do with Flexget.FlexGet.
Running FlexgetFlexGet
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 offlexget.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
it'sthis 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 selecting1
- If
SinceToI wantset itto runrunning every minute,Iyou may set it as* * * * *
then the absolute path of FlexGet, which is/homexx/username/bin/flexget
.ThenThen, add in the arguments offlexgetFlexFet 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 (which happens quite alot) and will flood your SSH inbox (accessible by typingmailin ssh),FlexGet, append> /dev/null 2>&1
right after execute
- Save your work with CTRL +
O,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,SayIyou want to run test-1 at 22:05, 22:45, 23:05, 23:45everydayevery 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 typingcd /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 FlexgetFlexGet
- To upgrade FlexGet, just run the following command:
"$HOME"/flexget/bin/python -m pip install flexget --upgrade
Removing FlexgetFlexGet
- To remove FlexGet, simply delete the flexget folder and your symbolic link.
rm -rfv "$HOME"/flexget
rm "$HOME"/bin/flexget
- If you want to uninstall Python
3 too,3, run the following commands
rm -rfv "$HOME"/.pyenv
- Remove the following lines from
.bashrc
export PATH="/homexx/username/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"