summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKyren223 <contact@kyren.codes>2025-08-27 19:12:30 +0300
committerKyren223 <contact@kyren.codes>2025-08-27 19:12:30 +0300
commit0ef5b8b280ce3f66f8d8e0a77a3c1746c28db298 (patch)
tree26931986bea158e32fdef60c23d046da0fc4837c /scripts
parent791c5b7904d9f756e341235adfcb6272b2f8d169 (diff)
Fixed timer
Diffstat (limited to 'scripts')
-rw-r--r--scripts/backup.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/backup.py b/scripts/backup.py
index 39eaeb1..1267f57 100644
--- a/scripts/backup.py
+++ b/scripts/backup.py
@@ -128,7 +128,10 @@ def get_total_size(local_dir):
for root, dirs, files in os.walk(local_dir):
for f in files:
fp = os.path.join(root, f)
- total += os.path.getsize(fp)
+ try:
+ total += os.path.getsize(fp)
+ except (OSError, PermissionError) as e:
+ print(f"Error getting size of '{fp}': {e}")
return total
if __name__ == "__main__":
@@ -156,10 +159,12 @@ if __name__ == "__main__":
print(f"Files existed (skipped): {files_existed}")
if mode == 'replace':
print(f"Files replaced (trashed + uploaded): {files_replaced}")
- print(f"Total file size: {total_size / (1024**3):.2f} GB")
- print(f"Total time: {total_time:.2f} seconds")
+ print(f"Total file size: {total_size / (1024**2):.2f} MB")
+ print(f"Total time: {total_time / 60:.2f} minutes")
if total_size > 0:
- time_per_gb = total_time / (total_size / (1024**3))
- print(f"Time per GB: {time_per_gb:.2f} seconds/GB")
+ time_per_gb = (total_time / 60) / (total_size / (1024**3))
+ print(f"Time per GB: {time_per_gb:.2f} minutes/GB")
+ megabits = total_size * 1024 * 128 # 128 is 1024/8
+ print(f"Speed: {megabits / total_time}mbps")
else:
print("Time per GB: N/A (zero size)")