Automating downloads with FlexGet
Media Miner
Take the strain out of downloading content from the Internet with FlexGet. Thanks to plugins, you can customize the tool to meet your requirements.
Your *nix operating system comes with a large selection of tools (e.g., cron) for handling recurring tasks, such as launching scripts at specific times; however, a number of other specialist tools can help the user in other areas as well. The FlexGet [1] Python tool specializes in automating Torrent, Usenet, podcast, comics, movie, and series downloads. To do so, it relies on RSS feeds [2], HTML pages, and CSV file sources. A graphical user interface [3] is currently on the development roadmap, but the current offering is still fairly rudimentary.
FlexGet gets much of its functionality from plugins [4]. The software tool initially requires some fairly complex configuration work, but once you have understood the principle and automated various applications, it will save you a huge amount of time. As an example, I show you how I can download episodes of a series from the German ZDF Mediathek site.
Installation
The first step is to install FlexGet. It is a good idea to type python -V
upfront to make sure you have at least Python version 2.6 or 2.7 on your system. To set up FlexGet, you can then use the Python Pip tool, which you might also need to install (Listing 1).
Listing 1
Installing Pip and FlexGet
A call to flexget -V
lets you check that the installation was successful and the program is up to date. In my case, the output is 1.2.324 You are on the latest release. The
pip install --upgrade flexget
command installs any updates [5].
Configuration
To create a configuration file, use the following sequence of commands:
$ cd ~/.config $ mkdir - p flexget $ cd flexget $ touch config.yml
The .yml
extension tells you that FlexGet uses configuration files in the YAML format [6]. YAML is a simplified markup language that has been implemented for the C, C++, JavaScript, ActionScript, Perl, PHP, Java, and Ruby programming languages; the .NET platform; and, most importantly here, for Python.
The formatting features of the configuration for FlexGet are colons and indents. Indents in YAML are always exactly two spaces wide and define the relationship between the entries. The use of tabs is prohibited. As a general rule, you need to pay very close attention to the correct syntax when creating the control file because FlexGet forgives virtually no mistakes (Figure 1).
The starting point of any configuration file is a task, which defines both the name and the plugins it contains. The three types of tasks are as follows:
- Input defines where FlexGet looks for content.
- Filter determines precisely which content you want from this location.
- Output defines where the software stores this content [7].
A simple configuration file with explanatory comments is shown in Listing 2. A task in Listing 3 downloads the "Linux Action Show" podcast. The command
flexget --test execute
runs the desired action without downloading for test purposes, which means you can check the configuration file for any errors up front. The
flexget execute
command then starts the download (Figure 2). For a deeper understanding, I can recommend the excellent FlexGet documentation.
Listing 2
YAML Configuration File
Listing 3
Podcast Download
With the individual plugins, you can customize FlexGet's behavior in a granular way to suit your own needs. The parameter that provides a plugin will be listed on the wiki page for the plugin in question. Once you have familiarized yourself with the available plugins, you will have a wide range of options for fine tuning. For example, the Series [8] filter gives you many control options for retrieving precisely what you want. It makes sense to extend and successively test the configuration file gradually.
Time-Controlled with Cron
After taking care of what, you can now move on to when; that is, how often you want FlexGet to look for new entries. A weekly search is enough for the TV series in this example. The use of a Cron job is the perfect way to avoid having to trigger the program manually every week.
Start by typing which flexget
to determine the path to the executable part of FlexGet: On Debian, the path is /usr/local/bin/
. Now type crontab -e
to open the input mask for a Cron job. If you have not yet defined an editor for the system, you will want to select Nano and type the following line as a test:
@hourly /usr/local/bin/ flexget --cron execute
After saving, you will see a confirmation that you have created a new Cron job.
By testing in this way, you can check FlexGet logfile whether the Cron job ran; the log resides in the same directory that holds the configuration file. If you want multiple tasks to run at different times, you have more clear-cut ways of managing the configuration.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4