This commit is contained in:
2026-05-18 07:04:08 +02:00
parent 52f04c2839
commit 07e6a9c374
8 changed files with 254 additions and 99 deletions
+20
View File
@@ -1,4 +1,5 @@
import ctypes
import time
from blake3 import blake3
@@ -17,6 +18,25 @@ def is_cloud_placeholder(path: str) -> bool:
return bool(attrs & _CLOUD_MASK)
def hydrate_file(path: str, timeout: int = 120, poll: int = 3) -> bool:
"""
Přinutí Dropbox stáhnout cloud placeholder otevřením souboru.
Čeká max timeout sekund. Vrátí True pokud se soubor stáhl.
"""
try:
with open(path, "rb") as f:
f.read(1)
except OSError:
pass
deadline = time.time() + timeout
while time.time() < deadline:
if not is_cloud_placeholder(path):
return True
time.sleep(poll)
return False
def blake3_file(path, chunk_size=1024 * 1024):
"""Spočítá BLAKE3 hash souboru po blocích (bez načtení do paměti)."""
h = blake3()