From 08fa371f49042a2989ec3d494f37b8db63b13c95 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 7 Jan 2020 20:05:57 +0100 Subject: script to run everything --- cli/app/utils/cortex_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cli/app/utils') 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: -- cgit v1.2.3-70-g09d2