From 6fb13eb4c061354a29338361cd1ac2260c4ad0d8 Mon Sep 17 00:00:00 2001 From: Brian Gregg Date: Wed, 5 Aug 2026 10:59:06 -0400 Subject: [PATCH] Re-add how the pid is created at a level higher than 1 - this was removed in a prior fix by accident. --- scan-batch-dir | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scan-batch-dir b/scan-batch-dir index 128a5c5..f1364ff 100755 --- a/scan-batch-dir +++ b/scan-batch-dir @@ -556,7 +556,13 @@ def process_tiff(file_path:str, level): # Create the JP2 derivative if it does not already exist. # if the JP2 does not exist: jp2_path = f"{dir}/{pid}.jp2" - out_pid = f"{pid}" + + # Only prefix with the parent when one actually exists — top-level + # (level == 1) files have no meaningful parent, matching process_file(). + if level == 1 or not parent: + out_pid = f"{pid}" + else: + out_pid = f"{parent}-{pid}" logger.info(f"Tiff: Creating JP2: {jp2_path}") if not os.path.exists(jp2_path): @@ -958,6 +964,8 @@ def process_file(df: pd.DataFrame, file_path: str, level): pid = f"{file_name}" if level == 1: parent_folder = '' + elif parent_folder: + pid = f"{parent_folder}-{file_name}" # Default row_data row_data = {