Support analog photo dates and correct gallery years

This commit is contained in:
2026-09-20 01:39:42 +03:30
parent dad62df66f
commit cf46d62ede
55 changed files with 183 additions and 75 deletions
+24 -6
View File
@@ -25,7 +25,7 @@ romania = [
(OLD[4], 2), (OLD[4], 3), (OLD[4], 4), (OLD[0], 0), (OLD[3], 0),
]
ungrouped = [(OLD[2], 2), (OLD[2], 3)]
ordered = armenia + romania + ungrouped
ordered = romania + armenia + ungrouped
assert len(ordered) == len(set(ordered)) == 18
collection_groups = [
@@ -112,13 +112,31 @@ collection_groups = [
paris = "85a558a3fcf582e6f0637d6927bb5a074de422f30a389ab9589630b9c163fc0e"
paris_lille = "e013523e4dda324d603c89f93ef3e83abbcd82cb11a16f85e53b670e8613d34f"
geneva = "18a628ae4ea72d0f9a68de6acfbc698449fe10e49ecf990a8ddced0b2e32949d"
iranian_memorial = "bf23ab31ef7b33150e9e99cb31f14b1bc27bc8143293a32bb1d4ac2193a493c6"
foto_64 = "1bb19ce5b6a5570ddda1754bb77583dbfb2b4c534ee88e85a69f511ab47b1a14"
uploaded_highlight_groups = [
(
"Iranian Martyrs’ Memorial Cemetery",
datetime(2025, 9, 19, 21, 43, 42, tzinfo=timezone.utc),
[(iranian_memorial, index) for index in range(2)],
),
(
"Geneva",
datetime(2025, 9, 19, 21, 42, 30, tzinfo=timezone.utc),
[(geneva, index) for index in range(3)],
),
(
"Paris & Lille",
datetime(2026, 9, 19, 21, 41, 30, tzinfo=timezone.utc),
datetime(2025, 9, 19, 21, 41, 30, tzinfo=timezone.utc),
[(paris_lille, index) for index in range(13)] +
[(paris, index) for index in range(10)],
),
(
"Foto 64",
datetime(2026, 9, 19, 12, 20, 30, tzinfo=timezone.utc),
[(foto_64, index) for index in range(4)],
),
]
anchors = {armenia[0]: "Armenia", romania[0]: "Romania"}
@@ -132,7 +150,7 @@ for job in OLD:
if batch:
batch.unlink()
start = datetime(2026, 9, 19, 12, 29, 33, tzinfo=timezone.utc)
start = datetime(2026, 9, 19, 12, 40, 33, tzinfo=timezone.utc)
for position, (job, index) in enumerate(ordered):
title = f"photo-{job}-{index:02}"
if (job, index) == first_for_job[job]:
@@ -167,7 +185,7 @@ for folder, group_start, anchor, filenames in collection_groups:
content = re.sub(r"^anchor:.*\n", "", content, flags=re.MULTILINE)
if position == 0:
content = content.replace("categories: art\n", "categories: art\nanchor: " +
json.dumps(anchor) + "\n", 1)
json.dumps(anchor, ensure_ascii=False) + "\n", 1)
path.write_text(content)
for anchor, group_start, photos in uploaded_highlight_groups:
@@ -180,8 +198,8 @@ for anchor, group_start, photos in uploaded_highlight_groups:
content = re.sub(r"^anchor:.*\n", "", content, flags=re.MULTILINE)
if position == 0:
content = content.replace("categories: art\n", "categories: art\nanchor: " +
json.dumps(anchor) + "\n", 1)
elif index == 0:
json.dumps(anchor, ensure_ascii=False) + "\n", 1)
elif index == 0 and f'id="photo-{job}"' not in content:
# Removing this batch's old highlight must not remove its published
# receipt target from the rendered gallery.
content = content.replace("---\n\n", f'---\n\n<div id="photo-{job}"></div>\n\n', 1)