NZBGet MySQL Extension Script

I wrote a simple plugin for NZBGet that inserts download history into a MySQL database. Having my download list in a database makes operations on the data easier than groking text logs.

I wanted to display my most recent downloads on a Grafana Dashboard:
Table of downloads

To use simply copy the Mysql-Log.py script into your NZBGet/scripts directory. In NZBGet, select settings and set the hostname of your MySQL instance.

You can download the plugin on github

This Plugin for NZBGet inserts a record into a user specified MySQL database. It requires these configuration options:

  • hostname of the MySQL server
  • MySQL port (optional)
  • MySQL username
  • MySQL password
  • mysql database name
  • table to insert records into

The script is written in python and requires the pymsql module: sudo pip install pymysql

The purpose of this script is to allow you to create a dashboard or other reporting around your downloads. You can search or group by name or timestamp to create summaries, aggregate peak download times, or whatever you want to gauge.

Fell free to submit improvements with a Pull Request (PR) or fork the project. I’m new to Python and there is a lot of room for improvement in this extension script.

Installation:

Download and copy the Mysql-Log.py file from this repo into your NZBGet/scripts directory. Alternatively, you can clone this repo directly into the /scripts/ directory:

1
2
3
4
# This directory will be where YOUR NZBGet installation is
cd /opt/nzbget/scripts
git clone https://github.com/chrisbergeron/nzbget-mysql.git
mv nzbget-mysql/Mysql-Log.py .

Usage:

In NZBGet go into Settings and at the bottom left you should see MYSQL-LOG:
Configuring Plugin

Add the hostname of your MySQL server and optionally the port number (default is 3306), a username and password for the mysql server, the name of the database and the table to insert the download names into.

After this, click on CATEGORIES, click Choose and select which extensions you’d like to enable for that Category:
Enable Extension in CATEGORIES
Enable MYSQL-LOG in CATEGORIES

If configured properly, after a download you’ll see lines like this in your NZBGet Messages:
Sample Log Output

Roadmap:

  • Separate Show Name, Episode Name, Season and Episode info, Quality and Crew into separate columns in the DB.

Technology Used:
Author

Chris Bergeron

Posted on

07-12-2018

Updated on

08-16-2021

Licensed under

Comments