mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
allow nzbget or sabnzbd to report failure.
This commit is contained in:
parent
6bd687cdbe
commit
661947d46c
3 changed files with 9 additions and 5 deletions
|
@ -251,7 +251,7 @@ class autoProcessMovie:
|
|||
else:
|
||||
logger.postprocess("FAILED DOWNLOAD DETECTED FOR %s" % (inputName), section)
|
||||
if failureLink:
|
||||
reportNzb(failureLink)
|
||||
reportNzb(failureLink, clientAgent)
|
||||
|
||||
if delete_failed and os.path.isdir(dirName) and not os.path.dirname(dirName) == dirName:
|
||||
logger.postprocess("Deleting failed files and folder %s" % dirName, section)
|
||||
|
|
|
@ -205,7 +205,7 @@ class autoProcessTV:
|
|||
logger.postprocess("SUCCESS: The download succeeded, sending a post-process request", section)
|
||||
else:
|
||||
if failureLink:
|
||||
reportNzb(failureLink)
|
||||
reportNzb(failureLink, clientAgent)
|
||||
if fork in nzbtomedia.SICKBEARD_FAILED or section == "NzbDrone":
|
||||
logger.postprocess("FAILED: The download failed. Sending 'failed' process request to %s branch" % (fork), section)
|
||||
else:
|
||||
|
|
|
@ -22,12 +22,16 @@ from nzbtomedia.utorrent.client import UTorrentClient
|
|||
from nzbtomedia.transmissionrpc.client import Client as TransmissionClient
|
||||
from nzbtomedia import logger, nzbToMediaDB
|
||||
|
||||
def reportNzb(failure_link):
|
||||
def reportNzb(failure_link, clientAgent):
|
||||
# Contact indexer site
|
||||
logger.info("Sending failure notification to indexer site")
|
||||
headers = None
|
||||
try:
|
||||
if clientAgent == 'nzbget':
|
||||
headers = {'User-Agent' : 'NZBGet / nzbToMedia.py'}
|
||||
elif clientAgent == 'sabnzbd':
|
||||
headers = {'User-Agent' : 'SABnzbd / nzbToMedia.py'}
|
||||
else:
|
||||
return
|
||||
try:
|
||||
r = requests.post(failure_link, headers=headers)
|
||||
except requests.ConnectionError:
|
||||
logger.error("Unable to open URL %s" % failure_link)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue