summaryrefslogtreecommitdiff
path: root/cli/app/utils/cortex_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/app/utils/cortex_utils.py')
-rw-r--r--cli/app/utils/cortex_utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/app/utils/cortex_utils.py b/cli/app/utils/cortex_utils.py
index 8076fda..50e85a4 100644
--- a/cli/app/utils/cortex_utils.py
+++ b/cli/app/utils/cortex_utils.py
@@ -10,7 +10,10 @@ def api_url(path):
"""Generate a base API path"""
return "https://lens.neural.garden/api/{}/".format(path)
-def fetch_cortex_folder(opt_folder_id):
+def cortex_folder(opt_folder_id):
+ return fetch_json(os.path.join(api_url('folder'), str(opt_folder_id) + "/"))
+
+def download_cortex_files(opt_folder_id):
"""Fetch all new, non-generated files in a Cortex folder"""
rows = fetch_json(api_url('file'), folder_id=opt_folder_id)
fp_out_dir = join(app_cfg.DIR_INPUTS, "cortex", str(opt_folder_id))
@@ -31,12 +34,12 @@ def find_unprocessed_files(files):
datasets = {}
unprocessed_files = []
for file in files:
- if file['generated'] == 1:
+ if file['generated'] == 1 and file['type'] == 'image':
fn, ext = os.path.splitext(file['name'])
dataset = fn.split('-')[0]
datasets[dataset] = file['id']
for file in files:
- if file['generated'] == 0 and file['processed'] != 1:
+ if file['generated'] == 0 and file['processed'] == 0 and file['type'] == 'image':
fn, ext = os.path.splitext(file['name'])
dataset = fn.split('-')[0]
if dataset not in datasets: