|
@@ -36,7 +36,7 @@ def trigger(request):
|
|
|
|
|
|
for path in paths:
|
|
|
automatic_import = AutomaticImport.objects(path=path).first()
|
|
|
- if(automatic_import is None):
|
|
|
+ if automatic_import is None:
|
|
|
volume = Volume()
|
|
|
volume.imageSequence = True
|
|
|
volume.path = os.path.join(path, DEFAULT_SLICE_FOLDER)
|
|
@@ -49,15 +49,11 @@ def trigger(request):
|
|
|
automatic_import.volume_id = str(volume.id)
|
|
|
automatic_import.save()
|
|
|
|
|
|
- # TODO: Why do next line is not work?
|
|
|
logger.info("Sequence in dir: " + path + " will be processed")
|
|
|
- print("Sequence in dir: " + path + " will be processed")
|
|
|
-
|
|
|
+
|
|
|
if len(volumes_to_process) > 0:
|
|
|
- # TODO: Why do next line is not work?
|
|
|
logger.info("Processing sequences in dir: " + settings.DEFAULT_IMPORT_PATH + " ...")
|
|
|
- print("Processing sequences in dir: " + settings.DEFAULT_IMPORT_PATH + " ...")
|
|
|
-
|
|
|
+
|
|
|
process = Process(target=SliceGenerator.generateListOfVolumes, args=(volumes_to_process,))
|
|
|
process.start()
|
|
|
|
|
@@ -71,23 +67,18 @@ def clear(request):
|
|
|
models = AutomaticImport.objects()
|
|
|
|
|
|
if len(models) == 0:
|
|
|
- # TODO: Why do next line is not work?
|
|
|
logger.info("No automatic imported volumes!")
|
|
|
- print("No automatic imported volumes!")
|
|
|
-
|
|
|
+
|
|
|
for automatic_import in models:
|
|
|
try:
|
|
|
volume = Volume.objects(id=automatic_import.volume_id)[0]
|
|
|
- except (IndexError, ValidationError) as e:
|
|
|
- return handleException(request, id, e)
|
|
|
-
|
|
|
- volume.delete()
|
|
|
+ volume.delete()
|
|
|
+ except IndexError as e:
|
|
|
+ logger.info("Volume with id = " + str(automatic_import.volume_id + " which was binded to AutomaticImport for path = " + automatic_import.path + " not found!"))
|
|
|
|
|
|
automatic_import.delete()
|
|
|
|
|
|
- # TODO: Why do next line is not work?
|
|
|
logger.info("Automaticly generated volume with id: " + automatic_import.volume_id + " deleted!")
|
|
|
- print("Automaticly generated volume with id: " + automatic_import.volume_id + " deleted!")
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return HttpResponse(json.dumps({'deleted': len(models)}), content_type="json")
|