From 4122ff3876b046a1c95272c903212495d79b8f0b Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 2 Feb 2013 00:33:07 -0800 Subject: [PATCH] added Transmission pass in. Not entirely sure about this one. Also added blackhole-subdirectory test. --- TorrentToMedia.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 7139a56b..b54a230c 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -39,15 +39,31 @@ if len(sys.argv) == 4: ##Stopped - 13 ## We will pass in %D, %N, %L from uTorrent + print "script called from utorrent" Directory = sys.argv[1] ## %D -- Example output: F:\path\to\dir\My.Series.S01E01.720p.HDTV.x264-2HD Name = sys.argv[2] ## %N -- Example output: My.Series.S01E01.720p.HDTV.x264-2HD Category = sys.argv[3] ## %L -- Example output: tvseries ## This is the label in uTorrent -else: +else len(sys.argv) == 7: ##test for Transmission here. - print "currently only supports uTorrent. Exiting" + #TR_APP_VERSION + #TR_TIME_LOCALTIME + #TR_TORRENT_DIR + #TR_TORRENT_HASH + #TR_TORRENT_ID + #TR_TORRENT_NAME + print "script called from Transmission" + Directory = sys.argv[3] + Name = sys.argv[6] + Category = os.path.basename(os.path.normpath(Directory)) #We assume the last directory is the category for now. + +else: + print "The number of arguments passed is", len(sys.argv), "unable to determin the arguments to use, Exiting sys.exit(-1) +if not Category: + Category = os.path.basename(os.path.normpath(Directory)) #Test for blackhole sub-directory. + status = 0 packed = 0