1 parent 66f81d7 commit 2e81908Copy full SHA for 2e81908
1 file changed
home/notion.py
@@ -295,4 +295,24 @@ async def album_check():
295
296
asyncio.run(album_check())
297
298
- breakpoint()
+
299
+ from pathlib import Path
300
301
+ async def update_album_from_local():
302
+ album_dir = Path("home/static/img/.hide/")
303
304
+ # get all .jpg files
305
+ jpg_files = sorted(album_dir.glob("*.jpg"))
306
307
+ for i, jpg_file in enumerate(jpg_files):
308
+ data = dict(
309
+ Name={"title": [{"text": {"content": jpg_file.stem}}]},
310
+ URL={"url": f"/static/img/.hide/{jpg_file.name}"},
311
+ Order={"number": int(jpg_file.stem.split("_")[-1])}
312
+ )
313
314
+ response = await notion_db_client.update_database(env.notion_sitedb_wedding_album_id, data)
315
316
+ if i > 4:
317
+ break
318
0 commit comments