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))
|
logger.info("Calling Gamez:" + inputCategory + " to post-process: %s" % (inputName))
|
||||||
result = nzbtomedia.autoProcessGames().process(outputDestination, inputName, status, clientAgent, inputCategory)
|
result = nzbtomedia.autoProcessGames().process(outputDestination, inputName, status, clientAgent, inputCategory)
|
||||||
|
|
||||||
if result != 0 and clientAgent != 'manual':
|
if result != 0:
|
||||||
logger.error("A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
if clientAgent != 'manual':
|
||||||
nzbtomedia.resume_torrent(clientAgent, inputHash, inputID, result, inputName)
|
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)
|
||||||
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
|
||||||
|
nzbtomedia.remove_torrent(clientAgent,inputHash,inputID,inputName)
|
||||||
|
|
||||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||||
nzbtomedia.cleanProcDirs()
|
nzbtomedia.cleanProcDirs()
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ from nzbtomedia.autoProcess.autoProcessTV import autoProcessTV
|
||||||
from nzbtomedia import logger, versionCheck, nzbToMediaDB
|
from nzbtomedia import logger, versionCheck, nzbToMediaDB
|
||||||
from nzbtomedia.nzbToMediaConfig import config
|
from nzbtomedia.nzbToMediaConfig import config
|
||||||
from nzbtomedia.nzbToMediaUtil import category_search, sanitizeFileName, copy_link, parse_args, flatten, get_dirnames, \
|
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, \
|
extractFiles, cleanProcDirs, update_downloadInfoStatus, get_downloadInfo, WakeUp, makeDir, joinPath, cleanProcDirs, \
|
||||||
create_torrent_class, listMediaFiles
|
create_torrent_class, listMediaFiles
|
||||||
from nzbtomedia.transcoder import transcoder
|
from nzbtomedia.transcoder import transcoder
|
||||||
|
@ -336,9 +336,6 @@ def initialize(section=None):
|
||||||
# create torrent class
|
# create torrent class
|
||||||
TORRENT_CLASS = create_torrent_class(TORRENT_CLIENTAGENT)
|
TORRENT_CLASS = create_torrent_class(TORRENT_CLIENTAGENT)
|
||||||
|
|
||||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
|
||||||
cleanProcDirs()
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -501,39 +501,42 @@ def create_torrent_class(clientAgent):
|
||||||
|
|
||||||
|
|
||||||
def pause_torrent(clientAgent, inputHash, inputID, inputName):
|
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))
|
logger.debug("Stoping torrent %s in %s while processing" % (inputName, clientAgent))
|
||||||
|
|
||||||
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) # Give Torrent client some time to catch up with the change
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def resume_torrent(clientAgent, inputHash, inputID, result, inputName):
|
def resume_torrent(clientAgent, inputHash, inputID, inputName):
|
||||||
# Hardlink solution for uTorrent, need to implent support for deluge, transmission
|
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
||||||
if clientAgent in ['utorrent', 'transmission', 'deluge'] and inputHash:
|
|
||||||
# Delete torrent and torrentdata from Torrent client if processing was successful.
|
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
if (nzbtomedia.DELETE_ORIGINAL == 1 and result != 1) or nzbtomedia.USELINK == 'move': # if we move files, nothing to resume seeding.
|
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
||||||
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
||||||
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
||||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
|
||||||
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
time.sleep(5)
|
||||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
|
||||||
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
||||||
# we always want to resume seeding, for now manually find out what is wrong when extraction fails
|
if nzbtomedia.DELETE_ORIGINAL == 1 or nzbtomedia.USELINK == 'move':
|
||||||
else:
|
logger.debug("Deleting torrent %s from %s" % (inputName, clientAgent))
|
||||||
logger.debug("Starting torrent %s in %s" % (inputName, clientAgent))
|
|
||||||
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
if clientAgent == 'utorrent' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
nzbtomedia.TORRENT_CLASS.start(inputHash)
|
nzbtomedia.TORRENT_CLASS.removedata(inputHash)
|
||||||
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
nzbtomedia.TORRENT_CLASS.remove(inputHash)
|
||||||
nzbtomedia.TORRENT_CLASS.start_torrent(inputID)
|
if clientAgent == 'transmission' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
nzbtomedia.TORRENT_CLASS.remove_torrent(inputID, True)
|
||||||
nzbtomedia.TORRENT_CLASS.core.resume_torrent([inputID])
|
if clientAgent == 'deluge' and nzbtomedia.TORRENT_CLASS != "":
|
||||||
|
nzbtomedia.TORRENT_CLASS.core.remove_torrent(inputID, True)
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
def find_download(clientAgent, download_id):
|
def find_download(clientAgent, download_id):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue