Added code in to confirm that the clientAgent returned from the download info in the DB is correct for the script being run so that nzb's don't get processed by torrent scripts and vise-versa.

This commit is contained in:
echel0n 2014-04-22 19:11:35 -07:00
commit 0e7b8eacab
3 changed files with 11 additions and 0 deletions

View file

@ -311,10 +311,14 @@ def main(args):
downloadInfo = nzbtomedia.get_downloadInfo(os.path.basename(dirName), 0) downloadInfo = nzbtomedia.get_downloadInfo(os.path.basename(dirName), 0)
if downloadInfo: if downloadInfo:
clientAgent = str(downloadInfo['client_agent'][0]) clientAgent = str(downloadInfo['client_agent'][0])
if not clientAgent.lower() in nzbtomedia.TORRENT_CLIENTS:
continue
inputHash = str(downloadInfo['input_hash'][0]) inputHash = str(downloadInfo['input_hash'][0])
inputID = str(downloadInfo['input_id'][0]) inputID = str(downloadInfo['input_id'][0])
logger.info("Found download info for %s, setting variables now ..." % (os.path.basename(dirName))) logger.info("Found download info for %s, setting variables now ..." % (os.path.basename(dirName)))
logger.info("Running %s:%s as a manual run for folder %s ..." % (section, category, dirName)) logger.info("Running %s:%s as a manual run for folder %s ..." % (section, category, dirName))
results = processTorrent(dirName, os.path.basename(dirName), category, inputHash, inputID, clientAgent) results = processTorrent(dirName, os.path.basename(dirName), category, inputHash, inputID, clientAgent)
if results != 0: if results != 0:

View file

@ -446,6 +446,9 @@ def main(args, section=None):
downloadInfo = get_downloadInfo(os.path.basename(dirName), 0) downloadInfo = get_downloadInfo(os.path.basename(dirName), 0)
if downloadInfo: if downloadInfo:
clientAgent = str(downloadInfo['client_agent'][0]) clientAgent = str(downloadInfo['client_agent'][0])
if not clientAgent.lower() in nzbtomedia.NZB_CLIENTS:
continue
download_id = str(downloadInfo['input_id'][0]) download_id = str(downloadInfo['input_id'][0])
logger.info("Found download info for %s, setting variables now ..." % (os.path.basename(dirName))) logger.info("Found download info for %s, setting variables now ..." % (os.path.basename(dirName)))

View file

@ -34,6 +34,10 @@ from nzbtomedia.nzbToMediaUtil import category_search, sanitizeFileName, copy_li
from nzbtomedia.transcoder import transcoder from nzbtomedia.transcoder import transcoder
from nzbtomedia.databases import mainDB from nzbtomedia.databases import mainDB
# Client Agents
NZB_CLIENTS = ['sabnzbd','nzbget']
TORRENT_CLIENTS = ['transmission', 'deluge', 'utorrent']
# sabnzbd constants # sabnzbd constants
SABNZB_NO_OF_ARGUMENTS = 8 SABNZB_NO_OF_ARGUMENTS = 8
SABNZB_0717_NO_OF_ARGUMENTS = 9 SABNZB_0717_NO_OF_ARGUMENTS = 9