mirror of
https://github.com/evilhero/mylar
synced 2025-01-03 05:24:43 +00:00
FIX: When retrieving a .torrent from a torrent provider (such as KAT), if the torrent was sent to the client but was unable to complete the send without an error (usually a 404), Mylar would stop searching - now will either log it and continue searching, or if Failed Handling is enabled will mark it as Failed and continue searching.
This commit is contained in:
parent
dadc4baec0
commit
f55c6f22e0
2 changed files with 53 additions and 2 deletions
|
@ -247,3 +247,40 @@ class FailedProcessor(object):
|
|||
else:
|
||||
logger.info(module + ' result has a status of ' + chk_fail['status'] + '. I am not sure what to do now.')
|
||||
return "nope"
|
||||
|
||||
def markFailed(self):
|
||||
#use this to forcibly mark a single issue as being Failed (ie. if a search result is sent to a client, but the result
|
||||
#ends up passing in a 404 or something that makes it so that the download can't be initiated).
|
||||
module = '[FAILED-DOWNLOAD]'
|
||||
|
||||
myDB = db.DBConnection()
|
||||
|
||||
logger.info(module + ' Marking as a Failed Download.')
|
||||
|
||||
logger.fdebug(module + 'nzb_name: ' + self.nzb_name)
|
||||
logger.fdebug(module + 'issueid: ' + str(self.issueid))
|
||||
logger.fdebug(module + 'nzb_id: ' + str(self.id))
|
||||
logger.fdebug(module + 'prov: ' + self.prov)
|
||||
|
||||
if 'annual' in self.nzb_name.lower():
|
||||
logger.info(module + ' Annual detected.')
|
||||
annchk = "yes"
|
||||
issuenzb = myDB.selectone("SELECT * from annuals WHERE IssueID=? AND ComicName NOT NULL", [self.issueid]).fetchone()
|
||||
else:
|
||||
issuenzb = myDB.selectone("SELECT * from issues WHERE IssueID=? AND ComicName NOT NULL", [self.issueid]).fetchone()
|
||||
|
||||
|
||||
ctrlVal = {"IssueID": self.issueid}
|
||||
Vals = {"Status": 'Failed'}
|
||||
myDB.upsert("issues", Vals, ctrlVal)
|
||||
|
||||
ctrlVal = {"ID": self.id,
|
||||
"Provider": self.prov,
|
||||
"NZBName": self.nzb_name}
|
||||
Vals = {"Status": 'Failed',
|
||||
"ComicName": issuenzb['ComicName'],
|
||||
"Issue_Number": issuenzb['Issue_Number']}
|
||||
myDB.upsert("failed", Vals, ctrlVal)
|
||||
|
||||
logger.info(module + ' Successfully marked as Failed.')
|
||||
|
||||
|
|
|
@ -1693,7 +1693,11 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
|
|||
|
||||
rcheck = rsscheck.torsend2client(ComicName, IssueNumber, comyear, link, nzbprov)
|
||||
if rcheck == "fail":
|
||||
logger.error("Unable to send torrent - check logs and settings.")
|
||||
if mylar.FAILED_DOWNLOAD_HANDLING:
|
||||
logger.error('Unable to send torrent to client. Assuming incomplete link - sending to Failed Handler and continuing search.')
|
||||
return FailedMark(ComicID=ComicID, IssueID=IssueID, id=nzbid, nzbname=nzbname, prov=nzbprov)
|
||||
else:
|
||||
logger.error('Unable to send torrent - check logs and settings (this would be marked as a BAD torrent if Failed Handling was enabled)')
|
||||
return "torrent-fail"
|
||||
if mylar.TORRENT_LOCAL:
|
||||
sent_to = "your local Watch folder"
|
||||
|
@ -1828,3 +1832,13 @@ def notify_snatch(nzbname, sent_to, modcomicname, comyear, IssueNumber, nzbprov)
|
|||
pushbullet.notify(snline=snline,snatched=nzbname,sent_to=sent_to,prov=nzbprov)
|
||||
|
||||
return
|
||||
|
||||
def FailedMark(IssueID, ComicID, id, nzbname, prov):
|
||||
# Used to pass a failed attempt at sending a download to a client, to the failed handler, and then back again to continue searching.
|
||||
|
||||
from mylar import Failed
|
||||
|
||||
FailProcess = Failed.FailedProcessor(issueid=IssueID, comicid=ComicID, id=id, nzb_name=nzbname, prov=prov)
|
||||
Markit = FailProcess.markFailed()
|
||||
|
||||
return "torrent-fail"
|
||||
|
|
Loading…
Reference in a new issue