delayrss - Getting NzbDrone to prefer NZBs over torrents

If you're like me, you don't want to miss an episode of any of your shows, so you have NzbDrone set up to search for both NZBs and torrents. What you may have noticed with this kind of setup is that torrents usually get posted faster than NZBs, which results in NzbDrone grabbing the torrent even though the NZB may only be a few minutes away. I like the security of using newsgroups, so I want the torrent to only be treated as a backup. Unfortunately, there is no way to set a preference in NzbDrone.

Until now.

Update on delayrss (read me)

As of late December 2014, delayed downloads have been incorporated directly into Sonarr/NzbDrone. I will leave this post up for those who may still find some use for this software, but the recommended approach is now to use the built-in Sonarr features. Review this post (specifically the Profiles section) to see how to use the new features.

delayrss: what is it?

delayrss is a little utility that I whipped up in node.js that acts as a time-shifting proxy. Basically it sits in between NzbDrone and the torrent RSS feeds. When NzbDrone requests a feed to check for new downloads, delayrss instead returns it a feed from sometime in the past. This delay is customizable, but I use 72 hours in my setup. This results in NzbDrone favoring NZBs, only falling back to torrents if the request can't be met by newsgroups within that 72 hour (or however long) period.

A few notes about delayrss:

  • It is smart enough to make sure the request is for the latest feed. If you do a manual search for a file, delayrss passes that request right through so you get up to date information.
  • The cache is not persistent. Whenever delayrss restarts, it will serve NzbDrone empty feeds until the delay period is met. In other words, if you have delayrss set to delay for 72 hours, then delayrss will send blank feeds for the first 72 hours.

Ok, I'm sold. How do I install it?

delayrss is a node.js application. So the first thing we need to do is install node.js. Download the latest version from nodejs.org by clicking the green Install button. Run the installer, and leave all the settings at their default value.

Once that's installed, download delayrss from here. Once downloaded (a whopping 2KB), extract it to a folder of your choosing. I chose to put in my home directory, so in my case the files are in C:\Users\foxingworth\delayrss. In the folder, you will find just three .js files. Right-click index.js and choose Edit.

The only lines that you might need to change are:

  • options['internval'] - Set this to whatever your NzbDrone RSS Sync Interval is. If you didn't change it, the default is 15.
  • options['kickass.to']['delay'] - Set this to how delayed you want Kick Ass Torrents to be, in hours.
  • options['ezrss.it']['delay'] - Set this to how delayed you want Eztv to be, in hours.

Save the file and close it.

Now we need to configure this to start up with the PC. Go to your start menu and type in schedule tasks and select the first result. On the right panel, select Create Basic Task. Enter delayrss as the Name. Click Next.

Change the Trigger to When the computer starts. Click Next

On the Action page, leave it on Start a Program and click Next. For Program/script, enter "C:\Program Files\nodejs\node.exe". For Add arguments (optional), type in the path to the index.js file, in my case it is C:\Users\foxingworth\delayrss\index.js. For Start in (optional), enter the path not including the file, in my case it is C:\Users\foxingworth\delayrss.

Click Next and then Finish.

When the Wizard closes, select Task Scheduler Library from the left panel. You should see delayrss listed in the middle with a status of Ready. Right-click it and select Run.

You should now see a console window pop up, Windows Firewall will ask if this application is permitted, click Allow access.

Leaving the console window running, switch back to Task Scheduler. Right-click delayrss again and select Properties. On the window that pops up, check Hidden in the lower left corner. Click OK. You can now close the Task Scheduler window. The app is running in a visible console window this time, but it will be hidden from view after the next reboot.

Configuring NzbDrone to use it

We now need to tell NzbDrone to use our proxy instead of going directly to the sites themselves. Log into your NzbDrone interface and go to Settings > Indexers.

Click KickassTorrents, and change Website URL from http://kickass.to to http://localhost:18000/kickass.to. Press save

Now click Eztv and change the Website URL from http://www.ezrss.it/ to http://localhost:18000/ezrss.it/. Press save.

Verifying that it is working

Switch to one of your shows and do a Manual Search on one of the episodes. You don't have to download anything, just wait for the results to populate and then click close.

Now click back to that console window that delayrss is running in and it should look something like this:

If you take a look at those two top entries, you'll see that they are for the feeds and delayrss intercepted the requests. The other requests are manual searches, and delayrss let the requests through untouched (as seen by the action being marked as pass-thru).

This was a quick little app that I cranked out in a few hours, so it hasn't gotten much testing. If you encouter a problem with, please comment and let me know.

Adding support for other indexes (advanced)

If you want to go beyond KickAssTorrents and Eztv, delayrss is set up in a way for you to do so.

In NzbDrone, go to the index that you want to delay, and change the Feed URL or Website URL to add a localhost:18000/ in between the http://  and the actual domain name. delayrss doesn't accept HTTPS connections, so change it to HTTP if that's needed. Now click Test and look at the console output of delayrss. You will see the request, and it will say Action taken: pass-thru, Reason: hostname unknown. What we care about is the URL it is requesting.

Here is an example from iptorrents.com:

Load the delayrss index.js file in a text editor and you will see the following section:

// Kickass options
options['kickass.to'] = {};
options['kickass.to']['delay'] = 72;    // in hours
options['kickass.to']['urls'] = ['/tv/1/'];
// ezRSS options
options['ezrss.it'] = {};
options['ezrss.it']['delay'] = 72;
options['ezrss.it']['urls'] = ['/feed/'];

To add more indexes, you need to create a new block like this:

options['domain_name'] = {};
options['domain_name']['delay'] = 72;
options['domain_name']['urls'] = ['/url/without/query'];

If you look back to my iptorrents example above, you would create a block like this to support it:

options['iptorrents.com'] = {};
options['iptorrents.com']['delay'] = 72;
options['iptorrents.com']['urls'] = ['/torrents/rss'];

Now restart delayrss and it will start handling the new indexer properly.