Mercurial > hg > orthanc-dicomweb
changeset 71:baa8c09df4c6
improvements to sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Oct 2015 18:33:53 +0200 |
parents | 562f792b1697 |
children | bfa7ed27ede9 |
files | Orthanc/Core/Enumerations.cpp Orthanc/Core/Toolbox.cpp Resources/SyncOrthancFolder.py |
diffstat | 3 files changed, 49 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/Orthanc/Core/Enumerations.cpp Fri Sep 25 15:31:36 2015 +0200 +++ b/Orthanc/Core/Enumerations.cpp Fri Oct 09 18:33:53 2015 +0200 @@ -44,6 +44,11 @@ // "Resources/GenerateErrorCodes.py" const char* EnumerationToString(ErrorCode error) { + if (error >= ErrorCode_START_PLUGINS) + { + return "Error encountered within some plugin"; + } + switch (error) { case ErrorCode_InternalError:
--- a/Orthanc/Core/Toolbox.cpp Fri Sep 25 15:31:36 2015 +0200 +++ b/Orthanc/Core/Toolbox.cpp Fri Oct 09 18:33:53 2015 +0200 @@ -468,9 +468,13 @@ assert(value < 16); if (value < 10) + { return value + '0'; + } else + { return (value - 10) + 'a'; + } } @@ -508,8 +512,8 @@ result.resize(32); for (unsigned int i = 0; i < 16; i++) { - result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16); - result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16); + result[2 * i] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] / 16)); + result[2 * i + 1] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] % 16)); } } #endif
--- a/Resources/SyncOrthancFolder.py Fri Sep 25 15:31:36 2015 +0200 +++ b/Resources/SyncOrthancFolder.py Fri Oct 09 18:33:53 2015 +0200 @@ -5,15 +5,14 @@ # to match the latest version of the Orthanc source code. # +import multiprocessing import os -import shutil +import stat import urllib2 +TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc') PLUGIN_SDK_VERSION = '0.9.4' - -SOURCE = '/home/jodogne/Subversion/Orthanc' -TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc') -REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw/Orthanc-%s/Plugins/Include' % PLUGIN_SDK_VERSION +REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw' FILES = [ 'Core/ChunkedBuffer.cpp', @@ -46,24 +45,46 @@ 'orthanc/OrthancCPlugin.h', ] +EXE = [ + 'Resources/WindowsResources.py', +] -for f in FILES: - source = os.path.join(SOURCE, f) - target = os.path.join(TARGET, f) + + + +def Download(x): + branch = x[0] + source = x[1] + target = os.path.join(TARGET, x[2]) + print target + try: os.makedirs(os.path.dirname(target)) except: pass - shutil.copy(source, target) + url = '%s/%s/%s' % (REPOSITORY, branch, source) + + with open(target, 'w') as f: + f.write(urllib2.urlopen(url).read()) + + +commands = [] + +for f in FILES: + commands.append([ 'default', f, f ]) for f in SDK: - source = '%s/%s' % (REPOSITORY, f) - target = os.path.join(TARGET, 'Sdk-%s' % PLUGIN_SDK_VERSION, f) - try: - os.makedirs(os.path.dirname(target)) - except: - pass + commands.append([ 'Orthanc-%s' % PLUGIN_SDK_VERSION, + 'Plugins/Include/%s' % f, + 'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) ]) + - with open(target, 'w') as g: - g.write(urllib2.urlopen(source).read()) +pool = multiprocessing.Pool(10) # simultaneous downloads +pool.map(Download, commands) + + +for exe in EXE: + path = os.path.join(TARGET, exe) + st = os.stat(path) + os.chmod(path, st.st_mode | stat.S_IEXEC)