aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-03-01 00:59:43 -0800
committerclarkzjw <[email protected]>2023-03-01 00:59:43 -0800
commit898701a2e3be108de7e50af90355076960e595f5 (patch)
treec8d9e61b4dbbedc8cb66d65ff6ef1b6da31ac9fa
parentb02fb79f03aec9a5b7be34b15f320eca4e5e5c66 (diff)
downloadphoto-898701a2e3be108de7e50af90355076960e595f5.tar.gz
sort photos by uploadedAt
-rw-r--r--_data/photos.json2
-rw-r--r--bot/bot.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/_data/photos.json b/_data/photos.json
index 602ddbe..0a4d8c9 100644
--- a/_data/photos.json
+++ b/_data/photos.json
@@ -1 +1 @@
[{"guid": "61881B2D-1B87-4C7B-B4EB-063836F10C90", "fileId": "2023-02-28-23-39-47-IMG_0070.webp", "width": 5280, "height": 3512, "ratio": 1.5034168564920274, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-02-28-23-39-47-IMG_0070.webp", "caption": "", "alt": "", "createdAt": "2023-02-28T23:39:47.000Z", "uploadedAt": "2023-02-28T23:39:47.000Z"}, {"guid": "B77DFD0A-342F-41F6-97ED-4FB289149A77", "fileId": "2023-02-28-23-43-55-IMG_0021.webp", "width": 5928, "height": 3992, "ratio": 1.4849699398797596, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-02-28-23-43-55-IMG_0021.webp", "caption": "", "alt": "", "createdAt": "2023-02-28T23:43:55.000Z", "uploadedAt": "2023-02-28T23:43:55.000Z"}, {"guid": "E3A61BC5-F07C-4681-94B0-AB4CCE4AB843", "fileId": "2023-03-01-00-52-37-IMG_0016.webp", "width": 3548, "height": 5268, "ratio": 0.6735003796507213, "orientation": "portrait", "path": "https://pixelstatic.jinwei.me/2023-03-01-00-52-37-IMG_0016.webp", "caption": "", "alt": "", "createdAt": "2023-03-01T00:52:37.000Z", "uploadedAt": "2023-03-01T00:52:37.000Z"}, {"guid": "D997B634-063F-4E32-B290-809D53DABFD2", "fileId": "2023-03-01-00-54-08-IMG_0134.webp", "width": 5328, "height": 3548, "ratio": 1.5016910935738443, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-03-01-00-54-08-IMG_0134.webp", "caption": "", "alt": "", "createdAt": "2023-03-01T00:54:08.000Z", "uploadedAt": "2023-03-01T00:54:08.000Z"}] \ No newline at end of file [{"guid": "480EDD16-EC60-4773-96BB-05C5643D6AA7", "fileId": "2023-03-01-00-59-03-IMG_0140.webp", "width": 3548, "height": 5268, "ratio": 0.6735003796507213, "orientation": "portrait", "path": "https://pixelstatic.jinwei.me/2023-03-01-00-59-03-IMG_0140.webp", "caption": "", "alt": "", "createdAt": "2023-03-01T00:59:03.000Z", "uploadedAt": "2023-03-01T00:59:03.000Z"}, {"guid": "D997B634-063F-4E32-B290-809D53DABFD2", "fileId": "2023-03-01-00-54-08-IMG_0134.webp", "width": 5328, "height": 3548, "ratio": 1.5016910935738443, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-03-01-00-54-08-IMG_0134.webp", "caption": "", "alt": "", "createdAt": "2023-03-01T00:54:08.000Z", "uploadedAt": "2023-03-01T00:54:08.000Z"}, {"guid": "E3A61BC5-F07C-4681-94B0-AB4CCE4AB843", "fileId": "2023-03-01-00-52-37-IMG_0016.webp", "width": 3548, "height": 5268, "ratio": 0.6735003796507213, "orientation": "portrait", "path": "https://pixelstatic.jinwei.me/2023-03-01-00-52-37-IMG_0016.webp", "caption": "", "alt": "", "createdAt": "2023-03-01T00:52:37.000Z", "uploadedAt": "2023-03-01T00:52:37.000Z"}, {"guid": "B77DFD0A-342F-41F6-97ED-4FB289149A77", "fileId": "2023-02-28-23-43-55-IMG_0021.webp", "width": 5928, "height": 3992, "ratio": 1.4849699398797596, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-02-28-23-43-55-IMG_0021.webp", "caption": "", "alt": "", "createdAt": "2023-02-28T23:43:55.000Z", "uploadedAt": "2023-02-28T23:43:55.000Z"}, {"guid": "61881B2D-1B87-4C7B-B4EB-063836F10C90", "fileId": "2023-02-28-23-39-47-IMG_0070.webp", "width": 5280, "height": 3512, "ratio": 1.5034168564920274, "orientation": "landscape", "path": "https://pixelstatic.jinwei.me/2023-02-28-23-39-47-IMG_0070.webp", "caption": "", "alt": "", "createdAt": "2023-02-28T23:39:47.000Z", "uploadedAt": "2023-02-28T23:39:47.000Z"}] \ No newline at end of file
diff --git a/bot/bot.py b/bot/bot.py
index 9d9b322..f379e95 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -73,6 +73,7 @@ def write_json() -> bool:
73 "createdAt": photo.createdAt.strftime("%Y-%m-%dT%H:%M:%S.000Z"), 73 "createdAt": photo.createdAt.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
74 "uploadedAt": photo.uploadedAt.strftime("%Y-%m-%dT%H:%M:%S.000Z") 74 "uploadedAt": photo.uploadedAt.strftime("%Y-%m-%dT%H:%M:%S.000Z")
75 }) 75 })
76 results.sort(key=lambda x: x["uploadedAt"], reverse=True)
76 with open("database/photos.json", "w") as f: 77 with open("database/photos.json", "w") as f:
77 f.write(json.dumps(results)) 78 f.write(json.dumps(results))
78 return True 79 return True
Powered by cgit v1.2.3 (git 2.41.0)