Page 1 of 1

Mark as failed

Posted: March 8th, 2016, 11:58 am
by qwdrty
Hello,

I wrote a pre-queue script to allow or refuse a ".nzb", depending of the group where the files have been posted. It works as expected but now, I want to mark the ".nzb" as failed instead of just delete it. I use Sonarr and Sonarr need to know if a download failed before trying another release.

My script:

Code: Select all

# -*- coding: utf-8 -*-
import sys

groups = tuple(sys.argv[7].split(' '))

if sys.argv[3] == 'tv':
    if 'alt.binaries.teevee' not in groups:
        print 0
        sys.exit(0)
elif sys.argv[3] == 'movies':
    if 'alt.binaries.moovee' not in groups:
        print 0
        sys.exit(0)

Re: Mark as failed

Posted: March 8th, 2016, 3:21 pm
by shypike
So you want the job to fail when its exit code is non-zero?

Re: Mark as failed

Posted: March 8th, 2016, 3:57 pm
by qwdrty
Hmm, I think my script was wrong :-X ..

updated script:

Code: Select all

# -*- coding: utf-8 -*-
import sys

groups = tuple(sys.argv[7].split(' '))

if sys.argv[3] == 'tv':
    if 'alt.binaries.teevee' not in groups:
        print 0
        sys.exit(0)
elif sys.argv[3] == 'movies':
    if 'alt.binaries.moovee' not in groups:
        print 0
        sys.exit(0)
So, I want to mark the file as failed in my history, when the script return 0.

Re: Mark as failed

Posted: March 9th, 2016, 4:22 pm
by shypike
Hmm.
Currently 0=discard, 1=accept.
Adding 2=accept+fail would be a compatible extension.
I'll give it a thought.
You can help us remember it by filing an issue in github (https://github.com/sabnzbd/sabnzbd/issues)