fix utorrent

This commit is contained in:
Clinton Hall 2013-02-27 21:59:13 -08:00
commit fe9f71ef8e

View file

@ -3,7 +3,6 @@ import logging.config
import os.path import os.path
import sys import sys
from utorrent.client import UTorrentClient
def nzbtomedia_configure_logging(dirname): def nzbtomedia_configure_logging(dirname):
logFile = os.path.join(dirname, "postprocess.log") logFile = os.path.join(dirname, "postprocess.log")
@ -15,26 +14,23 @@ def nzbtomedia_configure_logging(dirname):
def parse_other(args): def parse_other(args):
return os.path.normpath(sys.argv[1]), '', '' return os.path.normpath(sys.argv[1]), '', '', ''
def parse_utorrent(args): def parse_utorrent(args):
# uTorrent usage: call TorrentToMedia.py "%D" "%N" "%L" "%I" # uTorrent usage: call TorrentToMedia.py "%D" "%N" "%L" "%I"
inputDirectory = os.path.normpath(sys.argv[1]) inputDirectory = os.path.normpath(args[1])
inputName = sys.argv[2] inputName = args[2]
try: try:
inputCategory = sys.argv[3] inputCategory = args[3]
except: except:
inputCategory = '' inputCategory = ''
try: try:
inputHash = sys.argv[4] inputHash = args[4]
except: except:
inputHash = '' inputHash = ''
if inputHash: return inputDirectory, inputName, inputCategory, inputHash
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
return inputDirectory, inputName, inputCategory
def parse_deluge(args): def parse_deluge(args):
@ -42,7 +38,8 @@ def parse_deluge(args):
inputDirectory = os.path.normpath(sys.argv[3]) inputDirectory = os.path.normpath(sys.argv[3])
inputName = sys.argv[2] inputName = sys.argv[2]
inputCategory = '' # We dont have a category yet inputCategory = '' # We dont have a category yet
return inputDirectory, inputName, inputCategory inputHash = ''
return inputDirectory, inputName, inputCategory, inputHash
def parse_transmission(args): def parse_transmission(args):
@ -50,7 +47,8 @@ def parse_transmission(args):
inputDirectory = os.path.normpath(os.getenv('TR_TORRENT_DIR')) inputDirectory = os.path.normpath(os.getenv('TR_TORRENT_DIR'))
inputName = os.getenv('TR_TORRENT_NAME') inputName = os.getenv('TR_TORRENT_NAME')
inputCategory = '' # We dont have a category yet inputCategory = '' # We dont have a category yet
return inputDirectory, inputName, inputCategory inputHash = ''
return inputDirectory, inputName, inputCategory, inputHash
__ARG_PARSERS__ = { __ARG_PARSERS__ = {