mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -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
|
||||
|
||||
if clientAgent != 'manual':
|
||||
try:
|
||||
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
except:
|
||||
logger.warning("Failed to pause torrent %s in %s" % (inputName, clientAgent))
|
||||
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
if uniquePath:
|
||||
outputDestination = os.path.normpath(
|
||||
|
@ -224,20 +221,15 @@ 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")
|
||||
try:
|
||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
except:
|
||||
logger.warning("Failed to resume torrent %s in %s" % (inputName, clientAgent))
|
||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
else:
|
||||
if clientAgent != 'manual':
|
||||
# update download status in our DB
|
||||
nzbtomedia.update_downloadInfoStatus(inputName, 1)
|
||||
|
||||
# remove torrent
|
||||
try:
|
||||
nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
except:
|
||||
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
|
||||
nzbtomedia.remove_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
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
|
||||
|
|
|
@ -737,42 +737,44 @@ def create_torrent_class(clientAgent):
|
|||
|
||||
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
logger.debug("Stopping torrent %s in %s while processing" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
||||
|
||||
time.sleep(5)
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.stop_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.pause_torrent([inputID])
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to stop torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
def resume_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||
|
||||
time.sleep(5)
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to start torrent %s in %s" % (inputName, clientAgent))
|
||||
|
||||
def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
|
||||
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
||||
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
|
||||
else:
|
||||
resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue