|
@@ -3,6 +3,15 @@ import orthancDatabaseBrowser
|
|
|
import json
|
|
|
|
|
|
|
|
|
+def getJobId(jobDescription):
|
|
|
+ return jobDescription['ID']
|
|
|
+
|
|
|
+def getStatus(jobStatus):
|
|
|
+ return jobStatus['State']
|
|
|
+
|
|
|
+def isComplete(jobStatus):
|
|
|
+ return getStatus(jobStatus)=='Success'
|
|
|
+
|
|
|
class orthancPeers:
|
|
|
|
|
|
def __init__(self,net):
|
|
@@ -23,9 +32,20 @@ class orthancPeers:
|
|
|
#empty response
|
|
|
|
|
|
def sendResource(self,name,orthancId):
|
|
|
+ #returns jobDescription as JSON (ID,Path)
|
|
|
apiUrl=self.net.getCoreURL()
|
|
|
apiUrl+=f'/peers/{name}/store'
|
|
|
- response=self.net.post(apiUrl,orthancId,'text')
|
|
|
+ #response=self.net.post(apiUrl,orthancId,'text')
|
|
|
+ v={"Resources":[f'{orthancId}'],"Synchronous":False}
|
|
|
+ jsonData=json.dumps(v)
|
|
|
+ response=self.net.post(apiUrl,jsonData,'json')
|
|
|
+ return orthancDatabaseBrowser.extractJSON(response.data)
|
|
|
+
|
|
|
+ def checkJobStatus(self,name,jobId):
|
|
|
+ #returns jobStatus as JSON (ErrorCode, ErrorDescription, ErrorDetails, Progress, State)
|
|
|
+ apiUrl=self.net.getCoreURL()
|
|
|
+ apiUrl+=f'/jobs/{jobId}'
|
|
|
+ response=self.net.get(apiUrl)
|
|
|
return orthancDatabaseBrowser.extractJSON(response.data)
|
|
|
|
|
|
def test(self,name):
|