download-albums example: walk the albums from lib.fresh()
check / check (push) Successful in 1m32s

downloadAlbums now waits for a refresh from the server through lib.fresh()
before walking the albums, so albums and photos added since the cache was
last written are downloaded, and a failed refresh throws instead of
reporting an empty or stale library as done. The test's stand-in account
gains an album holding a new photo before the second run, and that run must
download it. The README's "Examples" section says the script opens the
library with the thumbnail and originals precache off, as `quak backup` does.

Model: opus-5-5
This commit is contained in:
2026-10-01 22:10:19 +00:00
parent 56641c6785
commit b42c5b0e0d
3 changed files with 52 additions and 17 deletions
+4 -1
View File
@@ -36,7 +36,10 @@ export async function downloadAlbums(
let alreadyLocal = 0;
// A photo in several albums is handled once.
const done = new Set<number>();
for (const album of lib.albums.list()) {
// fresh() waits for a refresh from the server and throws if it fails, so
// albums and photos added since the cache was last written are included.
const { albums } = await lib.fresh();
for (const album of albums.list()) {
const savePaths: string[] = [];
for (const photo of album.photos.list()) {
if (!done.has(photo.fileID)) {