Prompting.py ; Miscs for Interro29
This commit is contained in:
+5
-2
@@ -2,6 +2,8 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
def main():
|
||||
@@ -10,6 +12,7 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
work_dir = os.path.abspath(sys.argv[1])
|
||||
copies_dir = Path(work_dir) / "Copies"
|
||||
bnot_dir = sys.argv[2]
|
||||
target_subdir = os.path.join(work_dir, "A Rendre")
|
||||
os.makedirs(target_subdir, exist_ok=True)
|
||||
@@ -31,11 +34,11 @@ def main():
|
||||
copies_map = defaultdict(list)
|
||||
assigned_names = set() # To track which names were successfully linked
|
||||
|
||||
for filename in os.listdir(work_dir):
|
||||
for filename in os.listdir(copies_dir):
|
||||
match = pattern.match(filename)
|
||||
if match:
|
||||
copie_id = match.group(1)
|
||||
json_path = os.path.join(work_dir, filename)
|
||||
json_path = os.path.join(copies_dir, filename)
|
||||
try:
|
||||
with open(json_path, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
Reference in New Issue
Block a user