changeset 37:2ced2ca1c758

Multiple downloads.
author Catherine Wise <catherine.wise@csiro.au>
date Fri, 31 Jan 2014 11:32:24 +1100
parents 8e8a88fe0f4f
children f3143cb04928
files TrustStoreGalaxyImport.py TrustStoreGalaxyImport.xml
diffstat 2 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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 @@
         <exit_code range="4" err_level="fatal" description="Could not find supplied filename in store at path." />
         <exit_code range="5" err_level="fatal" description="Bad credentials supplied. See stdout for more information." />
     </stdio>
-    <command interpreter="python">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 </command> <!-- $output1.id $file_type </command> $__new_file_path__</command> -->
+    <command interpreter="python">TrustStoreGalaxyImport.py $username $password $storename $path $file_type $filename $output1 $output1.id $__new_file_path__</command>
     <inputs>
         <param name="file_type" type="select" label="File Format" help="Which format is the data you're downloading?">
             <option value="just list files"/>