From d5cdf2ad6971bba307434c519a618dfb2563dedc Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 17 Jan 2015 12:12:26 +1030 Subject: [PATCH] continue if failed to connect to torrent client. --- TorrentToMedia.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index a3ba48ca..2621c4f9 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -95,7 +95,10 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, uniquePath = 1 if clientAgent != 'manual': - nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) + try: + nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to pause torrent %s in %s" % (inputName, clientAgent)) if uniquePath: outputDestination = os.path.normpath( @@ -221,14 +224,20 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, if clientAgent != 'manual': logger.error( "A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding") - nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) + try: + nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to resume torrent %s in %s" % (inputName, clientAgent)) else: if clientAgent != 'manual': # update download status in our DB nzbtomedia.update_downloadInfoStatus(inputName, 1) # remove torrent - nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) + try: + nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName) + except: + logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent)) if not sectionName == 'UserScript': # for user script, we assume this is cleaned by the script or option USER_SCRIPT_CLEAN # cleanup our processing folders of any misc unwanted files and empty directories