photo-stats now count to year ago exactly

This commit is contained in:
azykov@mail.ru
2026-08-16 21:09:01 +03:00
parent 56917d9541
commit 184ccf1ac4
@@ -13,12 +13,15 @@ data:
ROOT = "/mnt/sdb2/immich/uploads/library" ROOT = "/mnt/sdb2/immich/uploads/library"
OUT_DIR = "/www" OUT_DIR = "/www"
CUTOFF = datetime(2025, 1, 1, tzinfo=timezone.utc).timestamp() current_date = datetime.now(timezone.utc)
cutoff_date = current_date.replace(year=current_date.year - 1)
CUTOFF = cutoff_date.timestamp()
RESCAN_INTERVAL_SECONDS = 6 * 3600 RESCAN_INTERVAL_SECONDS = 6 * 3600
state_lock = threading.Lock() state_lock = threading.Lock()
state = { state = {
"status": "starting", "status": "starting",
"cutoff_at": cutoff_date.isoformat(),
"processed": 0, "processed": 0,
"total": 0, "total": 0,
"percent": 0.0, "percent": 0.0,
@@ -64,15 +67,14 @@ data:
.err {{ color: #f66; }} .err {{ color: #f66; }}
</style></head><body> </style></head><body>
<h1>Photo library stats</h1> <h1>Photo library stats</h1>
<p>Path: {ROOT}</p>
<p>Status: <b>{s['status']}</b></p> <p>Status: <b>{s['status']}</b></p>
{progress_html} {progress_html}
{error_html} {error_html}
<table> <table>
<tr><td>Total files</td><td>{s['total_files']}</td></tr> <tr><td>Total files</td><td>{s['total_files']}</td></tr>
<tr><td>Total size</td><td>{human_size(s['total_size'])} ({s['total_size']} bytes)</td></tr> <tr><td>Total size</td><td>{human_size(s['total_size'])} ({s['total_size']} bytes)</td></tr>
<tr><td>Files newer than 2025-01-01</td><td>{s['recent_files']}</td></tr> <tr><td>Files newer than {s['cutoff_at']}</td><td>{s['recent_files']}</td></tr>
<tr><td>Size of files newer than 2025-01-01</td><td>{human_size(s['recent_size'])} ({s['recent_size']} bytes)</td></tr> <tr><td>Size of files newer than {s['cutoff_at']}</td><td>{human_size(s['recent_size'])} ({s['recent_size']} bytes)</td></tr>
<tr><td>Last scan started</td><td>{s['started_at'] or '-'}</td></tr> <tr><td>Last scan started</td><td>{s['started_at'] or '-'}</td></tr>
<tr><td>Last scan finished</td><td>{s['finished_at'] or '-'}</td></tr> <tr><td>Last scan finished</td><td>{s['finished_at'] or '-'}</td></tr>
</table> </table>