From 7368fe85cf15eb51a5042abdc18a19eff7c06dd4 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Sun, 26 Feb 2023 17:42:58 +0000 Subject: [PATCH] Backup alert! --- studio/backup_blends.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/studio/backup_blends.py b/studio/backup_blends.py index bbe3c20..f1ad53b 100644 --- a/studio/backup_blends.py +++ b/studio/backup_blends.py @@ -9,6 +9,7 @@ # License could be found in full text on gnu.org/licenses import os +import json import sys import time import hashlib @@ -68,6 +69,18 @@ def main(): # Main loop ( 30 seconds intervals ) while True: + + try: + with open(project+"/backup_data.json") as f: + backup_data = json.load(f) + except: + backup_data = {} + + backup_data["lastcheck"] = int(time.time()) + + with open(project+"/backup_data.json", "w") as f: + json.dump(backup_data, f, indent=4) + print("Counting another 30 seconds...") time.sleep(30) print("Checking for changed files...")