mirror of https://github.com/evilhero/mylar
Various fixes for DDL option
This commit is contained in:
parent
4af50e44a2
commit
74767215fb
|
@ -45,7 +45,7 @@ class PostProcessor(object):
|
|||
FOLDER_NAME = 2
|
||||
FILE_NAME = 3
|
||||
|
||||
def __init__(self, nzb_name, nzb_folder, issueid=None, module=None, queue=None, comicid=None, apicall=False):
|
||||
def __init__(self, nzb_name, nzb_folder, issueid=None, module=None, queue=None, comicid=None, apicall=False ,dll=False):
|
||||
"""
|
||||
Creates a new post processor with the given file path and optionally an NZB name.
|
||||
|
||||
|
@ -72,6 +72,11 @@ class PostProcessor(object):
|
|||
else:
|
||||
self.apicall = False
|
||||
|
||||
if ddl is True:
|
||||
self.ddl = True
|
||||
else:
|
||||
self.ddl = False
|
||||
|
||||
if mylar.CONFIG.FILE_OPTS == 'copy':
|
||||
self.fileop = shutil.copy
|
||||
else:
|
||||
|
@ -344,27 +349,31 @@ class PostProcessor(object):
|
|||
self._log("nzb folder: " + self.nzb_folder)
|
||||
logger.fdebug(module + ' nzb name: ' + self.nzb_name)
|
||||
logger.fdebug(module + ' nzb folder: ' + self.nzb_folder)
|
||||
if mylar.USE_SABNZBD==0:
|
||||
logger.fdebug(module + ' Not using SABnzbd')
|
||||
elif mylar.USE_SABNZBD != 0 and self.nzb_name == 'Manual Run':
|
||||
logger.fdebug(module + ' Not using SABnzbd : Manual Run')
|
||||
else:
|
||||
# if the SAB Directory option is enabled, let's use that folder name and append the jobname.
|
||||
if all([mylar.CONFIG.SAB_TO_MYLAR, mylar.CONFIG.SAB_DIRECTORY is not None, mylar.CONFIG.SAB_DIRECTORY != 'None']):
|
||||
self.nzb_folder = os.path.join(mylar.CONFIG.SAB_DIRECTORY, self.nzb_name).encode(mylar.SYS_ENCODING)
|
||||
logger.fdebug(module + ' SABnzbd Download folder option enabled. Directory set to : ' + self.nzb_folder)
|
||||
if self.ddl is False:
|
||||
if mylar.USE_SABNZBD==0:
|
||||
logger.fdebug(module + ' Not using SABnzbd')
|
||||
elif mylar.USE_SABNZBD != 0 and self.nzb_name == 'Manual Run':
|
||||
logger.fdebug(module + ' Not using SABnzbd : Manual Run')
|
||||
else:
|
||||
# if the SAB Directory option is enabled, let's use that folder name and append the jobname.
|
||||
if all([mylar.CONFIG.SAB_TO_MYLAR, mylar.CONFIG.SAB_DIRECTORY is not None, mylar.CONFIG.SAB_DIRECTORY != 'None']):
|
||||
self.nzb_folder = os.path.join(mylar.CONFIG.SAB_DIRECTORY, self.nzb_name).encode(mylar.SYS_ENCODING)
|
||||
logger.fdebug(module + ' SABnzbd Download folder option enabled. Directory set to : ' + self.nzb_folder)
|
||||
|
||||
if mylar.USE_NZBGET==1:
|
||||
if self.nzb_name != 'Manual Run':
|
||||
logger.fdebug(module + ' Using NZBGET')
|
||||
logger.fdebug(module + ' NZB name as passed from NZBGet: ' + self.nzb_name)
|
||||
# if the NZBGet Directory option is enabled, let's use that folder name and append the jobname.
|
||||
if self.nzb_name == 'Manual Run':
|
||||
logger.fdebug(module + ' Manual Run Post-Processing enabled.')
|
||||
elif all([mylar.CONFIG.NZBGET_DIRECTORY is not None, mylar.CONFIG.NZBGET_DIRECTORY is not 'None']):
|
||||
logger.fdebug(module + ' NZB name as passed from NZBGet: ' + self.nzb_name)
|
||||
self.nzb_folder = os.path.join(mylar.CONFIG.NZBGET_DIRECTORY, self.nzb_name).encode(mylar.SYS_ENCODING)
|
||||
logger.fdebug(module + ' NZBGET Download folder option enabled. Directory set to : ' + self.nzb_folder)
|
||||
else:
|
||||
logger.fdebug('%s Now performing post-processing of %s sent from DDL' % (module, nzb_name))
|
||||
|
||||
if mylar.USE_NZBGET==1:
|
||||
if self.nzb_name != 'Manual Run':
|
||||
logger.fdebug(module + ' Using NZBGET')
|
||||
logger.fdebug(module + ' NZB name as passed from NZBGet: ' + self.nzb_name)
|
||||
# if the NZBGet Directory option is enabled, let's use that folder name and append the jobname.
|
||||
if self.nzb_name == 'Manual Run':
|
||||
logger.fdebug(module + ' Manual Run Post-Processing enabled.')
|
||||
elif all([mylar.CONFIG.NZBGET_DIRECTORY is not None, mylar.CONFIG.NZBGET_DIRECTORY is not 'None']):
|
||||
logger.fdebug(module + ' NZB name as passed from NZBGet: ' + self.nzb_name)
|
||||
self.nzb_folder = os.path.join(mylar.CONFIG.NZBGET_DIRECTORY, self.nzb_name).encode(mylar.SYS_ENCODING)
|
||||
logger.fdebug(module + ' NZBGET Download folder option enabled. Directory set to : ' + self.nzb_folder)
|
||||
myDB = db.DBConnection()
|
||||
|
||||
self.oneoffinlist = False
|
||||
|
|
|
@ -358,6 +358,11 @@ class Api(object):
|
|||
else:
|
||||
comicid = kwargs['comicid']
|
||||
|
||||
if 'ddl' not in kwargs:
|
||||
ddl = False
|
||||
else:
|
||||
ddl = True
|
||||
|
||||
if 'apc_version' not in kwargs:
|
||||
logger.info('Received API Request for PostProcessing %s [%s]. Queueing...' % (self.nzb_name, self.nzb_folder))
|
||||
mylar.PP_QUEUE.put({'nzb_name': self.nzb_name,
|
||||
|
@ -365,7 +370,8 @@ class Api(object):
|
|||
'issueid': issueid,
|
||||
'failed': failed,
|
||||
'comicid': comicid,
|
||||
'apicall': True})
|
||||
'apicall': True,
|
||||
'ddl': ddl})
|
||||
self.data = 'Successfully submitted request for post-processing for %s' % self.nzb_name
|
||||
#fp = process.Process(self.nzb_name, self.nzb_folder, issueid=issueid, failed=failed, comicid=comicid, apicall=True)
|
||||
#self.data = fp.post_process()
|
||||
|
|
|
@ -134,6 +134,7 @@ class GC(object):
|
|||
series = option_find
|
||||
elif 'Year' in option_find:
|
||||
year = option_find.findNext(text=True)
|
||||
year = re.sub('|', '', year).strip()
|
||||
else:
|
||||
if 'Size' in prev_option:
|
||||
size = option_find #.findNext(text=True)
|
||||
|
@ -141,7 +142,7 @@ class GC(object):
|
|||
break
|
||||
i+=1
|
||||
|
||||
logger.fdebug('%s [%s] / %s' % (series, year, size))
|
||||
logger.fdebug('Now downloading: %s [%s] / %s ... this can take a while (go get some take-out)...' % (series, year, size))
|
||||
|
||||
link = None
|
||||
for f in soup.findAll("div", {"class": "aio-pulse"}):
|
||||
|
|
|
@ -3040,7 +3040,10 @@ def postprocess_main(queue):
|
|||
break
|
||||
|
||||
if mylar.APILOCK is False:
|
||||
pprocess = process.Process(item['nzb_name'], item['nzb_folder'], item['failed'], item['issueid'], item['comicid'], item['apicall'])
|
||||
try:
|
||||
pprocess = process.Process(item['nzb_name'], item['nzb_folder'], item['failed'], item['issueid'], item['comicid'], item['apicall'], item['ddl'])
|
||||
except:
|
||||
pprocess = process.Process(item['nzb_name'], item['nzb_folder'], item['failed'], item['issueid'], item['comicid'], item['apicall'])
|
||||
pp = pprocess.post_process()
|
||||
time.sleep(5) #arbitrary sleep to let the process attempt to finish pp'ing
|
||||
|
||||
|
@ -3122,7 +3125,8 @@ def nzb_monitor(queue):
|
|||
'failed': nzstat['failed'],
|
||||
'issueid': nzstat['issueid'],
|
||||
'comicid': nzstat['comicid'],
|
||||
'apicall': nzstat['apicall']})
|
||||
'apicall': nzstat['apicall'],
|
||||
'ddl': False})
|
||||
#cc = process.Process(nzstat['name'], nzstat['location'], failed=nzstat['failed'])
|
||||
#nzpp = cc.post_process()
|
||||
except Exception as e:
|
||||
|
|
|
@ -228,7 +228,8 @@ class NZBGet(object):
|
|||
'failed': False,
|
||||
'issueid': nzbinfo['issueid'],
|
||||
'comicid': nzbinfo['comicid'],
|
||||
'apicall': True}
|
||||
'apicall': True,
|
||||
'ddl': False}
|
||||
else:
|
||||
logger.warn('Could not find completed NZBID %s in history' % nzbid)
|
||||
return {'status': False}
|
||||
|
|
|
@ -21,13 +21,14 @@ import logger
|
|||
|
||||
class Process(object):
|
||||
|
||||
def __init__(self, nzb_name, nzb_folder, failed=False, issueid=None, comicid=None, apicall=False):
|
||||
def __init__(self, nzb_name, nzb_folder, failed=False, issueid=None, comicid=None, apicall=False, ddl=False):
|
||||
self.nzb_name = nzb_name
|
||||
self.nzb_folder = nzb_folder
|
||||
self.failed = failed
|
||||
self.issueid = issueid
|
||||
self.comicid = comicid
|
||||
self.apicall = apicall
|
||||
self.ddl = ddl
|
||||
|
||||
def post_process(self):
|
||||
if self.failed == '0':
|
||||
|
@ -39,7 +40,7 @@ class Process(object):
|
|||
retry_outside = False
|
||||
|
||||
if self.failed is False:
|
||||
PostProcess = mylar.PostProcessor.PostProcessor(self.nzb_name, self.nzb_folder, self.issueid, queue=queue, comicid=self.comicid, apicall=self.apicall)
|
||||
PostProcess = mylar.PostProcessor.PostProcessor(self.nzb_name, self.nzb_folder, self.issueid, queue=queue, comicid=self.comicid, apicall=self.apicall, ddl=self.ddl)
|
||||
if any([self.nzb_name == 'Manual Run', self.nzb_name == 'Manual+Run', self.apicall is True, self.issueid is not None]):
|
||||
threading.Thread(target=PostProcess.Process).start()
|
||||
else:
|
||||
|
|
|
@ -131,7 +131,8 @@ class SABnzbd(object):
|
|||
'failed': False,
|
||||
'issueid': nzbinfo['issueid'],
|
||||
'comicid': nzbinfo['comicid'],
|
||||
'apicall': True}
|
||||
'apicall': True,
|
||||
'ddl': False}
|
||||
break
|
||||
else:
|
||||
logger.info('no file found where it should be @ %s - is there another script that moves things after completion ?' % hq['storage'])
|
||||
|
@ -152,7 +153,8 @@ class SABnzbd(object):
|
|||
'failed': True,
|
||||
'issueid': sendresponse['issueid'],
|
||||
'comicid': sendresponse['comicid'],
|
||||
'apicall': True}
|
||||
'apicall': True,
|
||||
'ddl': False}
|
||||
break
|
||||
break
|
||||
|
||||
|
|
|
@ -1463,10 +1463,10 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
|
|||
links = entry['link']
|
||||
searchresult = searcher(nzbprov, nzbname, mylar.COMICINFO, links, IssueID, ComicID, tmpprov, newznab=newznab_host, torznab=torznab_host, rss=RSS)
|
||||
|
||||
if searchresult == 'downloadchk-fail' or searchresult == 'double-pp':
|
||||
if any([searchresult == 'downloadchk-fail', searchresult == 'double-pp']):
|
||||
foundc['status'] = False
|
||||
continue
|
||||
elif searchresult == 'torrent-fail' or searchresult == 'nzbget-fail' or searchresult == 'sab-fail' or searchresult == 'blackhole-fail':
|
||||
elif any([searchresult == 'torrent-fail', searchresult == 'nzbget-fail', searchresult == 'sab-fail', searchresult == 'blackhole-fail', searchresult == 'ddl-fail']):
|
||||
foundc['status'] = False
|
||||
return foundc
|
||||
|
||||
|
@ -1498,9 +1498,12 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
|
|||
if 'Public Torrents' in tmpprov and any([nzbprov == 'WWT', nzbprov == 'DEM']):
|
||||
tmpprov = re.sub('Public Torrents', nzbprov, tmpprov)
|
||||
foundcomic.append("yes")
|
||||
|
||||
if mylar.COMICINFO[0]['pack']:
|
||||
issinfo = mylar.COMICINFO[0]['pack_issuelist']
|
||||
logger.info('mylar.COMICINFO: %s' % mylar.COMICINFO)
|
||||
if mylar.COMICINFO[0]['pack'] is True:
|
||||
try:
|
||||
issinfo = mylar.COMICINFO[0]['pack_issuelist']
|
||||
except:
|
||||
issinfo = mylar.COMICINFO['pack_issuelist']
|
||||
if issinfo is not None:
|
||||
#we need to get EVERY issue ID within the pack and update the log to reflect that they're being downloaded via a pack.
|
||||
logger.fdebug("Found matching comic within pack...preparing to send to Updater with IssueIDs: " + str(issueid_info) + " and nzbname of " + str(nzbname))
|
||||
|
@ -2307,7 +2310,11 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
|||
'issueid': IssueID,
|
||||
'failed': False,
|
||||
'comicid': ComicID,
|
||||
'apicall': True})
|
||||
'apicall': True,
|
||||
'ddl': True})
|
||||
else:
|
||||
logger.info('Failed to retrieve %s from the DDL site.' %s (nzbname))
|
||||
return "ddl-fail"
|
||||
|
||||
sent_to = "is downloading it directly via DDL"
|
||||
|
||||
|
|
Loading…
Reference in New Issue