diff OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3950:5797ca4f3b8d transcoding

"/peers/{id}/store": New option "Transcode"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 19 May 2020 20:37:00 +0200
parents 8f7ad4989fec
children
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Tue May 19 18:44:36 2020 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Tue May 19 20:37:00 2020 +0200
@@ -1136,21 +1136,31 @@
     std::unique_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context));
 
     GetInstancesToExport(request, *job, remote, call);
+
+    static const char* TRANSCODE = "Transcode";
+    if (request.type() == Json::objectValue &&
+        request.isMember(TRANSCODE))
+    {
+      job->SetTranscode(SerializationToolbox::ReadString(request, TRANSCODE));
+    }
     
-    OrthancConfiguration::ReaderLock lock;
-
-    WebServiceParameters peer;
-    if (lock.GetConfiguration().LookupOrthancPeer(peer, remote))
     {
-      job->SetPeer(peer);    
-      OrthancRestApi::GetApi(call).SubmitCommandsJob
-        (call, job.release(), true /* synchronous by default */, request);
+      OrthancConfiguration::ReaderLock lock;
+      
+      WebServiceParameters peer;
+      if (lock.GetConfiguration().LookupOrthancPeer(peer, remote))
+      {
+        job->SetPeer(peer);    
+      }
+      else
+      {
+        throw OrthancException(ErrorCode_UnknownResource,
+                               "No peer with symbolic name: " + remote);
+      }
     }
-    else
-    {
-      throw OrthancException(ErrorCode_UnknownResource,
-                             "No peer with symbolic name: " + remote);
-    }
+
+    OrthancRestApi::GetApi(call).SubmitCommandsJob
+      (call, job.release(), true /* synchronous by default */, request);
   }
 
   static void PeerSystem(RestApiGetCall& call)