mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Fixes issue with torrent not resuming or removing.
This commit is contained in:
parent
4d1ec040e9
commit
63157919fa
3 changed files with 35 additions and 31 deletions
|
@ -184,14 +184,18 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
logger.info("Calling Gamez:" + inputCategory + " to post-process: %s" % (inputName))
|
||||
result = nzbtomedia.autoProcessGames().process(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||
|
||||
if result != 0 and clientAgent != 'manual':
|
||||
if result != 0:
|
||||
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, result, inputName)
|
||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
else:
|
||||
if clientAgent != 'manual':
|
||||
# update download status in our DB
|
||||
nzbtomedia.update_downloadInfoStatus(inputName, 1)
|
||||
|
||||
# remove torrent
|
||||
nzbtomedia.remove_torrent(clientAgent,inputHash,inputID,inputName)
|
||||
|
||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||
nzbtomedia.cleanProcDirs()
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ from nzbtomedia.autoProcess.autoProcessTV import autoProcessTV
|
|||
from nzbtomedia import logger, versionCheck, nzbToMediaDB
|
||||
from nzbtomedia.nzbToMediaConfig import config
|
||||
from nzbtomedia.nzbToMediaUtil import category_search, sanitizeFileName, copy_link, parse_args, flatten, get_dirnames, \
|
||||
remove_read_only, pause_torrent, resume_torrent, listMediaFiles, joinPath, \
|
||||
remove_read_only, pause_torrent, resume_torrent, remove_torrent, listMediaFiles, joinPath, \
|
||||
extractFiles, cleanProcDirs, update_downloadInfoStatus, get_downloadInfo, WakeUp, makeDir, joinPath, cleanProcDirs, \
|
||||
create_torrent_class, listMediaFiles
|
||||
from nzbtomedia.transcoder import transcoder
|
||||
|
@ -336,9 +336,6 @@ def initialize(section=None):
|
|||
# create torrent class
|
||||
TORRENT_CLASS = create_torrent_class(TORRENT_CLIENTAGENT)
|
||||
|
||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||
cleanProcDirs()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -501,23 +501,34 @@ def create_torrent_class(clientAgent):
|
|||
|
||||
|
||||
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
||||
# if we are using links with Torrents it means we need to pause it in order to access the files
|
||||
logger.debug("Stoping 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) # Give Torrent client some time to catch up with the change
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def resume_torrent(clientAgent, inputHash, inputID, result, inputName):
|
||||
# Hardlink solution for uTorrent, need to implent support for deluge, transmission
|
||||
if clientAgent in ['utorrent', 'transmission', 'deluge'] and inputHash:
|
||||
# Delete torrent and torrentdata from Torrent client if processing was successful.
|
||||
if (nzbtomedia.DELETE_ORIGINAL == 1 and result != 1) or nzbtomedia.USELINK == 'move': # if we move files, nothing to resume seeding.
|
||||
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)
|
||||
|
||||
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)
|
||||
|
@ -525,15 +536,7 @@ def resume_torrent(clientAgent, inputHash, inputID, result, inputName):
|
|||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||
# we always want to resume seeding, for now manually find out what is wrong when extraction fails
|
||||
else:
|
||||
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)
|
||||
|
||||
def find_download(clientAgent, download_id):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue