mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
Forgot to add linkage between our new function parsing and TorrentToMedia
This commit is contained in:
parent
dc379491e8
commit
36a3dabadb
2 changed files with 18 additions and 2 deletions
|
@ -22,6 +22,11 @@ from utorrent.client import UTorrentClient
|
|||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def category_search_recurs(inputDirectory, inputName, root, categories):
|
||||
pass
|
||||
|
||||
|
||||
def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||
categorySearch = [os.path.normpath(inputDirectory),""] #initializie
|
||||
notfound = 0
|
||||
|
@ -272,7 +277,7 @@ config.read(configFilename)
|
|||
clientAgent = config.get("Torrent", "clientAgent")
|
||||
|
||||
try:
|
||||
parse_args(clientAgent)
|
||||
inputDirectory, inputName, inputCategory = parse_args(clientAgent)
|
||||
except:
|
||||
Logger.error("MAIN: There was a problem loading variables: Exiting")
|
||||
sys.exit(-1)
|
||||
|
|
|
@ -13,9 +13,11 @@ def nzbtomedia_configure_logging(dirname):
|
|||
fileHandler.level = logging.DEBUG
|
||||
logging.getLogger().addHandler(fileHandler)
|
||||
|
||||
|
||||
def parse_other(args):
|
||||
return os.path.normpath(sys.argv[1]), '', ''
|
||||
|
||||
|
||||
def parse_utorrent(args):
|
||||
# uTorrent usage: call TorrentToMedia.py "%D" "%N" "%L" "%I"
|
||||
inputDirectory = os.path.normpath(sys.argv[1])
|
||||
|
@ -28,20 +30,28 @@ def parse_utorrent(args):
|
|||
inputHash = sys.argv[4]
|
||||
except:
|
||||
inputHash = ''
|
||||
|
||||
if inputHash:
|
||||
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
|
||||
|
||||
return inputDirectory, inputName, inputCategory
|
||||
|
||||
|
||||
def parse_deluge(args):
|
||||
# Deluge usage: call TorrentToMedia.py TORRENT_ID TORRENT_NAME TORRENT_DIR
|
||||
inputDirectory = os.path.normpath(sys.argv[3])
|
||||
inputName = sys.argv[2]
|
||||
inputCategory = '' # We dont have a category yet
|
||||
return inputDirectory, inputName, inputCategory
|
||||
|
||||
|
||||
def parse_transmission(args):
|
||||
# Transmission usage: call TorrenToMedia.py (%TR_TORRENT_DIR% %TR_TORRENT_NAME% is passed on as environmental variables)
|
||||
inputDirectory = os.path.normpath(os.getenv('TR_TORRENT_DIR'))
|
||||
inputName = os.getenv('TR_TORRENT_NAME')
|
||||
inputCategory = '' # We dont have a category yet
|
||||
return inputDirectory, inputName, inputCategory
|
||||
|
||||
|
||||
__ARG_PARSERS__ = {
|
||||
'other': parse_other,
|
||||
|
@ -50,8 +60,9 @@ __ARG_PARSERS__ = {
|
|||
'transmission': parse_transmission,
|
||||
}
|
||||
|
||||
|
||||
def parse_args(clientAgent):
|
||||
parseFunc = __ARG_PARSERS__.get(clientAgent, None)
|
||||
if not parseFunc:
|
||||
raise RuntimeError("Could not find client-agent")
|
||||
parseFunc(sys.argv)
|
||||
return parseFunc(sys.argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue