Ver código fonte

Adding networkConfig flag to setup will use other server as the one specified in network.json. File named in networkConfig should exist in .labkey directory of the user executing the script

NIX User 2 anos atrás
pai
commit
f13644aaa3
1 arquivos alterados com 14 adições e 3 exclusões
  1. 14 3
      pythonScripts/scanOrthancQuick.py

+ 14 - 3
pythonScripts/scanOrthancQuick.py

@@ -24,6 +24,9 @@ def main(parameterFile):
     with open(fsetup,'r') as f:
         setup=json.load(f)
 
+    with open(parameterFile) as f:
+        pars=json.load(f)
+
     sys.path.insert(0,setup['paths']['nixWrapper'])
     import nixWrapper
 
@@ -35,7 +38,17 @@ def main(parameterFile):
     import orthancInterface
     import orthancDatabaseBrowser
 
-    fconfig=os.path.join(fhome,'.labkey','network.json')
+    try:
+        networkSetup=pars['networkSetup']
+    except KeyError:
+        networkSetup='network.json'
+
+    fconfig=os.path.join(fhome,'.labkey',networkSetup)
+    
+    if not os.path.isfile(fconfig):
+        print('Failed to find network configuration {}'.format(fconfig))
+        return
+
 
     net=labkeyInterface.labkeyInterface()
     net.init(fconfig)
@@ -47,8 +60,6 @@ def main(parameterFile):
     odb=orthancDatabaseBrowser.orthancDB(onet)
 
 
-    with open(parameterFile) as f:
-        pars=json.load(f)
 
     opars=pars['Orthanc']
     project=opars['project']