Page 1 of 1

Set Category based on NZB name

Posted: July 22nd, 2014, 4:58 am
by OneNonlyNova
Hey guys,

sorry if this is already on here somewhere but i did not find anything useful
via search...

i wrote a little programm for myself which checks some forums topics
every so often and looks for new posted nzbs... i have categorys set up
for all those different topics and would like sabnzbd to set the category
according to the nzb file name eg:

Test-abc
Test-gfd
Test-fkd

would go to category Test

Test2-fopd
Test2-ldfc
Test2-fdkm

would go to category Test2

is that possible somehow?

EDIT: forgot to say i could also create a rss feed for each category if that would help

Regards and thx in advance

Alex

Re: Set Category based on NZB name

Posted: July 22nd, 2014, 9:24 am
by sander
Yes, that's possible.

Hints:

Code: Select all

~$ python
Python 2.7.3 (default, Feb 27 2014, 20:00:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> nzbname = "Test2-fdkm"
>>> nzbname.split('-')[0]
'Test2'
Combine that with the python script given on the page about SABnzbd Pre-processing script (http://wiki.sabnzbd.org/user-pre-queue-script)


So ... untested code ... :

Code: Select all

#!/usr/bin/env python

import sys

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
    downloadsize = int(downloadsize)
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script



print "1"    # Accept
print
print
print nzbname.split('-')[0]      # Category
print
print
print

sys.exit(0)    # 0 means OK
HTH

Re: Set Category based on NZB name

Posted: July 22nd, 2014, 9:29 am
by OneNonlyNova
well i'm a stupid idiot... just found out that i can just
save the nzb's from my programm to subfolders of the watched folder
that are named like the categories... :/

very quickly done and i did so much searching on that... :D

thanks anyways @ sander!

maybe you guys should move that from a little [1] to a full text feature!