Enable post-processing from nzbget

If ComicRN.py is called from an NZBget post-processing script, the
downloaded comic should be processed correctly. For safety, this should
be filtered by category at the NZBget end.
This commit is contained in:
TheLabRatt 2013-03-04 16:16:40 +00:00
parent 3050d2cfa8
commit b5091c1ead
2 changed files with 36 additions and 24 deletions

View File

@ -139,6 +139,9 @@ class PostProcessor(object):
self._log("nzb folder: " + str(self.nzb_folder), logger.DEBUG)
logger.fdebug("nzb name: " + str(self.nzb_name))
logger.fdebug("nzb folder: " + str(self.nzb_folder))
if mylar.USE_SABNZBD==0:
logger.fdebug("Not using SABNzbd")
else:
# if the SAB Directory option is enabled, let's use that folder name and append the jobname.
if mylar.SAB_DIRECTORY is not None and mylar.SAB_DIRECTORY is not 'None' and len(mylar.SAB_DIRECTORY) > 4:
self.nzb_folder = os.path.join(mylar.SAB_DIRECTORY, self.nzb_name).encode(mylar.SYS_ENCODING)
@ -158,6 +161,9 @@ class PostProcessor(object):
sabrepd = dom.getElementsByTagName('replace_dots')[0].firstChild.wholeText
logger.fdebug("SAB Replace Spaces: " + str(sabreps))
logger.fdebug("SAB Replace Dots: " + str(sabrepd))
if mylar.USE_NZBGET==1:
logger.fdebug("Using NZBGET")
logger.fdebug("NZB name as passed from NZBGet: " + self.nzb_name)
myDB = db.DBConnection()
nzbname = self.nzb_name
@ -175,6 +181,8 @@ class PostProcessor(object):
nzbname = re.sub('[\&]', 'and', str(nzbname))
logger.fdebug("After conversions, nzbname is : " + str(nzbname))
# if mylar.USE_NZBGET==1:
# nzbname=self.nzb_name
self._log("nzbname: " + str(nzbname), logger.DEBUG)
nzbiss = myDB.action("SELECT * from nzblog WHERE nzbname=?", [nzbname]).fetchone()

View File

@ -3,11 +3,15 @@
import sys
import sys, os
import autoProcessComics
if len(sys.argv) < 2:
print "No folder supplied - is this being called from SABnzbd?"
if os.getenv('NZBPP_NZBCOMPLETED', 0):
#if this variable is set, we're being called from NZBGet
autoProcessComics.processEpisode(os.getenv('NZBPP_DIRECTORY'), os.getenv('NZBPP_NZBFILENAME'))
else:
print "No folder supplied - is this being called from SABnzbd or NZBGet?"
sys.exit()
elif len(sys.argv) >= 3:
autoProcessComics.processEpisode(sys.argv[1], sys.argv[3])