Skip to content

Commit 421046e

Browse files
committed
OrthancFolderImporter: allow working without saving the state in a file
1 parent d8d70a0 commit 421046e

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $ docker exec -it xxxx bash
9595
9696
/# pip3 install orthanc-tools
9797
98-
/# python3 -m orthanc_tools.orthanc_folder_importer --folder=/import --url=http://localhost:8042 --user=test --password=test --skip_extensions=.cne,.bmp,.ini
98+
/# python3 -m orthanc_tools.orthanc_folder_importer --folder_path=/import --url=http://localhost:8042 --user=test --password=test --skip_extensions=.cne,.bmp,.ini --worker_threads_count=5
9999
100100
```
101101

Diff for: orthanc_tools/orthanc_folder_importer.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ def add_file_name_in_errors_log(self, file_path):
6060
f.write(file_path + "\n")
6161

6262
def add_folder_path_in_state_file(self, folder_path):
63-
with self._lock:
64-
with open(self._state_path, "at") as f:
65-
f.write(folder_path + "\n")
63+
if self._state_path:
64+
with self._lock:
65+
with open(self._state_path, "at") as f:
66+
f.write(folder_path + "\n")
6667

6768
def upload_and_label(self, path_to_upload):
6869
"""
@@ -172,7 +173,7 @@ def _process_path(self, worker_id):
172173

173174
def execute(self):
174175
# read state
175-
if os.path.isfile(self._state_path):
176+
if self._state_path and os.path.isfile(self._state_path):
176177
with open(self._state_path, 'r') as file:
177178
lines = file.readlines()
178179
self._folders_uploaded = [line.strip() for line in lines]

Diff for: release-notes.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v 0.16.1
2+
========
3+
- `OrthancFolderImporter`: allow working without saving the state in a file
4+
15
v 0.16.0
26
========
37
- BREAKING_CHANGE `OrthancCleaner` can now filter on `modalities in study`. Rules file format has changed.

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# For a discussion on single-sourcing the version across setup.py and the
2929
# project code, see
3030
# https://packaging.python.org/guides/single-sourcing-package-version/
31-
version='0.16.0', # Required
31+
version='0.16.1', # Required
3232

3333
# This is a one-line description or tagline of what your project does. This
3434
# corresponds to the "Summary" metadata field:

0 commit comments

Comments
 (0)