# HG changeset patch # User Catherine Wise # Date 1391128344 -39600 # Node ID 2ced2ca1c75877e4dfc1bdaafcac732a37789291 # Parent 8e8a88fe0f4f8c74588f08a3ef540831721057ca Multiple downloads. diff -r 8e8a88fe0f4f -r 2ced2ca1c758 TrustStoreGalaxyImport.py --- a/TrustStoreGalaxyImport.py Thu Jan 23 15:05:41 2014 +1100 +++ b/TrustStoreGalaxyImport.py Fri Jan 31 11:32:24 2014 +1100 @@ -50,24 +50,24 @@ if __name__ == '__main__': - kms_url = sys.argv[1] - ims_url = sys.argv[2] - username = sys.argv[3] - password = sys.argv[4] - client_key = sys.argv[5] - client_secret = sys.argv[6] - storename = sys.argv[7] - path = sys.argv[8] + kms_url = "https://tstest-kms.it.csiro.au/kmscolab_3_0" + ims_url = "https://tstest-ims.it.csiro.au/ims_3_0/services/IMS" + username = sys.argv[1] + password = sys.argv[2] + client_key = "desktop" + client_secret = "cpU92F1PT7VOCANjSknuCDp4DrubmujoBaF6b0miz8OpKNokEbGMHCaSFK5/lISbBmaaGVCgeADI2A39F3Hkeg==" + storename = sys.argv[3] + path = sys.argv[4] + fileType = sys.argv[5] filename = "" outputFile = "" - if len(sys.argv) > 10: - filename = sys.argv[9] - outputFile = sys.argv[10] - # outputFileId = sys.argv[11] - # outputFileType = sys.argv[12] - # otherFilesDir = sys.argv[13] + if len(sys.argv) > 9: + filename = sys.argv[6] + outputFile = sys.argv[7] + outputFileId = sys.argv[8] + otherFilesDir = sys.argv[9] else: - outputFile = sys.argv[9] + outputFile = sys.argv[6] config = TrustStoreClient.Config(ims_url, kms_url, client_key, client_secret) ts = TrustStoreClient.TrustStoreClient(headless=True, config=config) @@ -94,13 +94,13 @@ if filename and filename != "": outputFileList = [outputFile] inputFileList = None - # if "," in filename: # we have multiple files guys. - # inputFileList = filename.split(",") - # for inputFile in inputFileList: - # outName = "%s_%s_%s_%s_%s" % ('primary', outputFileId, inputFile.replace(".","-"), 'visible', outputFileType) - # outputFileList.append(os.path.join(otherFilesDir, outName)) - # else: - inputFileList = [filename] + if "," in filename: # we have multiple files guys. + inputFileList = filename.split(",") + for inputFile in inputFileList[1:]: # First file will be sent to outputFile. + outName = "%s_%s_%s_%s_%s" % ('primary', outputFileId, inputFile.replace(".","-"), 'visible', fileType) + outputFileList.append(os.path.join(otherFilesDir, outName)) + else: + inputFileList = [filename] for inFile, outFile in zip(inputFileList, outputFileList): downloadMe = ts_utils.ts_utils.recurseToChildNamed(location, inFile) if downloadMe: @@ -118,5 +118,5 @@ print e print root if not found: - print "Store not found" + print "Store %s not found" % storename sys.exit(2) diff -r 8e8a88fe0f4f -r 2ced2ca1c758 TrustStoreGalaxyImport.xml --- a/TrustStoreGalaxyImport.xml Thu Jan 23 15:05:41 2014 +1100 +++ b/TrustStoreGalaxyImport.xml Fri Jan 31 11:32:24 2014 +1100 @@ -6,7 +6,7 @@ - TrustStoreGalaxyImport.py https://tstest-kms.it.csiro.au/kmscolab_3_0 https://tstest-ims.it.csiro.au/ims_3_0/services/IMS $username $password desktop cpU92F1PT7VOCANjSknuCDp4DrubmujoBaF6b0miz8OpKNokEbGMHCaSFK5/lISbBmaaGVCgeADI2A39F3Hkeg== $storename $path $filename $output1 + TrustStoreGalaxyImport.py $username $password $storename $path $file_type $filename $output1 $output1.id $__new_file_path__