teste upload
This commit is contained in:
1 parent
60f64fb996
commit
c850ab1ef1
14 files changed
+174161
-169852
No files matched your search
@@ -1,6 +1,7 @@
|
||||
# main.py
|
||||
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
@@ -274,5 +275,43 @@ def main_parallel():
|
||||
pass # Erro já logado na função ou irrelevante se arquivos não existirem
|
||||
|
||||
|
||||
def rebuild_indexes():
|
||||
"""
|
||||
Função auxiliar para regerar all.json e all.yml baseada nos arquivos processados.
|
||||
Pode ser chamada pela API após um upload.
|
||||
"""
|
||||
logging.info("Regerando índices globais (all.json / all.yml)...")
|
||||
|
||||
# Lista todos os JSONs individuais na pasta metadata (exceto os manifestos e o all.json)
|
||||
all_data = []
|
||||
ignored_files = [
|
||||
"all.json",
|
||||
"samples-manifest.json",
|
||||
"mmp-manifest.json",
|
||||
"dependency_report.json",
|
||||
]
|
||||
|
||||
if os.path.exists(METADATA_FOLDER):
|
||||
for f in os.listdir(METADATA_FOLDER):
|
||||
if f.endswith(".json") and f not in ignored_files:
|
||||
try:
|
||||
with open(
|
||||
os.path.join(METADATA_FOLDER, f), "r", encoding="utf-8"
|
||||
) as json_file:
|
||||
data = json.load(
|
||||
json_file
|
||||
) # Precisa importar json no topo se não tiver
|
||||
all_data.append(data)
|
||||
except Exception as e:
|
||||
logging.error(f"Erro ao ler {f} para índice global: {e}")
|
||||
|
||||
if all_data:
|
||||
save_to_json(all_data, os.path.join(METADATA_FOLDER, "all.json"))
|
||||
save_to_yaml(all_data, os.path.join(DATA_FOLDER, "all.yml"))
|
||||
logging.info("Índices globais atualizados com sucesso.")
|
||||
|
||||
return len(all_data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main_parallel()
|
||||
Reference in new issue
Block a user