Page 1 of 1

SABnzbd, Sonarr & Scripts

Posted: February 16th, 2015, 3:10 pm
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?

Re: SABnzbd, Sonarr & Scripts

Posted: February 19th, 2015, 5:44 pm
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)


Re: SABnzbd, Sonarr & Scripts

Posted: February 19th, 2015, 11:44 pm
by Vincent9756
Thanks