SABnzbd, Sonarr & Scripts

Come up with a useful post-processing script? Share it here!
Post Reply
Vincent9756
Newbie
Newbie
Posts: 5
Joined: March 4th, 2014, 9:09 pm

SABnzbd, Sonarr & Scripts

Post by Vincent9756 »

I'm trying to understand the order that things happen. I'm using Sonarr (formerly NzbDrone) with completed download handling enabled *and* I'm running a post processing script.

Every minute, Sonarr checks with SABnzbd to see if a download is complete. Bottom line: I don't want Sonarr to pick the files until my script finishes execution.

Does SABnzbd wait until my script finishes before it (and hopefully Sonarr) considers the download complete?
Zybeon
Newbie
Newbie
Posts: 1
Joined: February 19th, 2015, 4:37 pm

Re: SABnzbd, Sonarr & Scripts

Post by Zybeon »

No, Sonarr does not wait.

Find SABNZBD script help here: http://wiki.sabnzbd.org/user-scripts

You have to disable (Drone Factory Folder Scanning) by setting it to '0' in the advanced settings.
https://github.com/Sonarr/Sonarr/wiki/D ... r-Scanning

Then you have to force a scan at the end of your script.

python requires the REQUESTS module

Code: Select all

import requests, json
try:
    r = requests.post("http://localhost:8989/api/command", data=json.dumps({'name': 'downloadedepisodesscan', 'path': sys.argv[1]}), headers={'X-Api-Key': 'API_KEY_HERE'})
    rstate = r.json()
    print "Sonarr responds as "+rstate['state']+"."
except:
    print "Update to Sonarr failed, check if Sonarr is running, your API key, or check install of python module requests."
    sys.exit(1)
sys.exit(0)

Vincent9756
Newbie
Newbie
Posts: 5
Joined: March 4th, 2014, 9:09 pm

Re: SABnzbd, Sonarr & Scripts

Post by Vincent9756 »

Thanks
Post Reply