Public Access
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import os
|
|
import json
|
|
import time
|
|
|
|
# FORCAGE DU CHEMIN ABSOLU
|
|
BASE_DIR = "/DATA/AppData/MULTI-IA-AETHAS38"
|
|
os.makedirs(BASE_DIR, exist_ok=True)
|
|
HISTORY_FILE = os.path.join(BASE_DIR, "aethas_history.json")
|
|
|
|
def load_history():
|
|
if not os.path.exists(HISTORY_FILE):
|
|
with open(HISTORY_FILE, 'w', encoding='utf-8') as f:
|
|
json.dump({}, f)
|
|
with open(HISTORY_FILE, 'r', encoding='utf-8') as f:
|
|
return json.load(f)
|
|
|
|
def save_history(history):
|
|
with open(HISTORY_FILE, 'w', encoding='utf-8') as f:
|
|
json.dump(history, f, indent=4)
|
|
|
|
def nettoyer_vieilles_discussions():
|
|
history = load_history()
|
|
now = time.time()
|
|
un_an_en_secondes = 365 * 24 * 60 * 60
|
|
a_supprimer = [cid for cid, data in history.items() if not data.get('pinned', False) and now - data.get('timestamp', now) > un_an_en_secondes]
|
|
if a_supprimer:
|
|
for cid in a_supprimer:
|
|
del history[cid]
|
|
save_history(history)
|
|
print(f"🧹 AETHAS CORE : Nettoyage auto terminé. {len(a_supprimer)} discussion(s) supprimée(s).") |