Files
wfrp-4e-de/python/merge_actors.py
T
alzerandalzer 0bcbc29f0f Skripts
2025-05-15 21:36:04 +02:00

22 lines
716 B
Python

import json
import os
# Verzeichnis mit den übersetzten Dateien
input_directory = "actors_split_translated"
output_file = "wfrp4e-eis-actors-merged.json"
# Alle übersetzten Dateien finden
merged_actors = {}
for file_name in os.listdir(input_directory):
if file_name.endswith(".json"):
file_path = os.path.join(input_directory, file_name)
with open(file_path, 'r', encoding='utf-8') as file:
data = json.load(file)
merged_actors.update(data)
# Gesamte Datei speichern
with open(output_file, 'w', encoding='utf-8') as out_file:
json.dump(merged_actors, out_file, ensure_ascii=False, indent=4)
print(f"{len(merged_actors)} Einträge erfolgreich zusammengeführt.")