Mark as failed

Come up with a useful post-processing script? Share it here!
Post Reply
qwdrty
Newbie
Newbie
Posts: 2
Joined: March 8th, 2016, 11:22 am

Mark as failed

Post 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)
Last edited by qwdrty on March 8th, 2016, 9:05 pm, edited 6 times in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Mark as failed

Post by shypike »

So you want the job to fail when its exit code is non-zero?
qwdrty
Newbie
Newbie
Posts: 2
Joined: March 8th, 2016, 11:22 am

Re: Mark as failed

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Mark as failed

Post 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)
Post Reply