@@ -43,7 +43,7 @@ def initialize(connection):
4343# ----------------- Tag Methods -----------------
4444
4545
46- tag_categories = ["actions" , "bodyparts" ]
46+ tag_categories = ["actions" , "bodyparts" , "bdsm" , "clothing" , "describingperson" , "environment" , "describingbody" , "describingimage" , "describingscene" , "sextoys" ]
4747
4848def get_all_tags_from_server_result (result ):
4949 alltags = []
@@ -91,7 +91,11 @@ def remove_tagme_tags_from_images(image_ids):
9191def add_tags_to_image (image_id , tag_ids ):
9292 stash .update_images ({"ids" : [image_id ], "tag_ids" : {"ids" : tag_ids , "mode" : "ADD" }})
9393
94+ worker_counter = 0
95+
9496def get_image_paths_and_ids (images ):
97+ global worker_counter
98+ counter_updated = False
9599 imagePaths = []
96100 imageIds = []
97101 temp_files = []
@@ -100,14 +104,25 @@ def get_image_paths_and_ids(images):
100104 imagePath = image ['files' ][0 ]['path' ]
101105 imageId = image ['id' ]
102106 if '.zip' in imagePath :
107+ if not counter_updated :
108+ worker_counter += 1
109+ counter_updated = True
103110 zip_index = imagePath .index ('.zip' ) + 4
104111 zip_path , img_path = imagePath [:zip_index ], imagePath [zip_index + 1 :].replace ('\\ ' , '/' )
112+
113+ # Create a unique temporary directory for this worker
114+ temp_dir = os .path .join (config .temp_image_dir , f"worker_{ worker_counter } " )
115+ os .makedirs (temp_dir , exist_ok = True )
116+
117+ temp_path = os .path .join (temp_dir , img_path )
118+ os .makedirs (os .path .dirname (temp_path ), exist_ok = True )
119+
105120 with zipfile .ZipFile (zip_path , 'r' ) as zip_ref :
106- temp_path = os .path .join (config .temp_image_dir , img_path )
107- os .makedirs (os .path .dirname (temp_path ), exist_ok = True )
108- zip_ref .extract (img_path , config .temp_image_dir )
121+ zip_ref .extract (img_path , temp_dir )
109122 imagePath = os .path .abspath (os .path .normpath (temp_path ))
110- temp_files .append (imagePath )
123+
124+ temp_files .append (temp_path )
125+ temp_files .append (temp_dir ) # Ensure the temp directory is also added to temp_files
111126 imagePaths .append (imagePath )
112127 imageIds .append (imageId )
113128 except IndexError :
0 commit comments