US05-02: Orchestrate Album Upload Batches (#72)
This commit was merged in pull request #72.
This commit is contained in:
@@ -24,7 +24,16 @@ _CHUNK = 1 << 20
|
||||
|
||||
|
||||
def sha256_file(path: Path | str) -> str:
|
||||
digest = hashlib.sha256()
|
||||
return _digest_file(path, hashlib.sha256())
|
||||
|
||||
|
||||
def sha1_file(path: Path | str) -> str:
|
||||
"""SHA-1 of the file bytes. Not an identity hash here — it is the checksum
|
||||
Immich/immich-go use to recognise an asset they already hold (concept §8)."""
|
||||
return _digest_file(path, hashlib.sha1())
|
||||
|
||||
|
||||
def _digest_file(path: Path | str, digest) -> str:
|
||||
with open(path, "rb") as handle:
|
||||
for chunk in iter(lambda: handle.read(_CHUNK), b""):
|
||||
digest.update(chunk)
|
||||
|
||||
Reference in New Issue
Block a user