mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
better warning logging for torrent actions.
This commit is contained in:
parent
d5cdf2ad69
commit
9f99d1be38
2 changed files with 35 additions and 41 deletions
|
@ -95,10 +95,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
||||||
uniquePath = 1
|
uniquePath = 1
|
||||||
|
|
||||||
if clientAgent != 'manual':
|
if clientAgent != 'manual':
|
||||||
try:
|
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
|
||||||
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
|
|
||||||
except:
|
|
||||||
logger.warning("Failed to pause torrent %s in %s" % (inputName, clientAgent))
|
|
||||||
|
|
||||||
if uniquePath:
|
if uniquePath:
|
||||||
outputDestination = os.path.normpath(
|
outputDestination = os.path.normpath(
|
||||||
|
@ -224,20 +221,15 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
||||||
if clientAgent != 'manual':
|
if clientAgent != 'manual':
|
||||||
logger.error(
|
logger.error(
|
||||||
"A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
"A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
||||||
try:
|
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
|
||||||
except:
|
|
||||||
logger.warning("Failed to resume torrent %s in %s" % (inputName, clientAgent))
|
|
||||||
else:
|
else:
|
||||||
if clientAgent != 'manual':
|
if clientAgent != 'manual':
|
||||||
# update download status in our DB
|
# update download status in our DB
|
||||||
nzbtomedia.update_downloadInfoStatus(inputName, 1)
|
nzbtomedia.update_downloadInfoStatus(inputName, 1)
|
||||||
|
|
||||||
# remove torrent
|
# remove torrent
|
||||||
try:
|
nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName)
|
||||||
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
|
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
|
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||||
|
|
|
@ -737,42 +737,44 @@ def create_torrent_class(clientAgent):
|
||||||
|
|
||||||
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
||||||
logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent))
|
logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent))
|
||||||
|
try:
|
||||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
||||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
||||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
||||||
|
time.sleep(5)
|
||||||
time.sleep(5)
|
except:
|
||||||
|
logger.warning("Failed to stop torrent %s in %s" % (inputName, clientAgent))
|
||||||
|
|
||||||
def resume_torrent(clientAgent, inputHash, inputID, inputName):
|
def resume_torrent(clientAgent, inputHash, inputID, inputName):
|
||||||
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
||||||
|
try:
|
||||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||||
|
time.sleep(5)
|
||||||
time.sleep(5)
|
except:
|
||||||
|
logger.warning("Failed to start torrent %s in %s" % (inputName, clientAgent))
|
||||||
|
|
||||||
def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
||||||
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
|
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
|
||||||
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
||||||
|
try:
|
||||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||||
|
time.sleep(5)
|
||||||
time.sleep(5)
|
except:
|
||||||
|
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
|
||||||
else:
|
else:
|
||||||
resume_torrent(clientAgent, inputHash, inputID, inputName)
|
resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue