Add Dresden Prague Tehran and Belfast highlights

This commit is contained in:
2026-09-20 00:53:38 +03:30
parent 2b90dccd83
commit 4364593529
46 changed files with 142 additions and 59 deletions
+52 -3
View File
@@ -44,6 +44,7 @@ collection_groups = [
"Bistoon_000521270027.jpg", "Bistoon_000521270026.jpg",
"Bistoon_000521270025.jpg", "Bazaar-e-Tabriz_000521270010.jpg",
"Bazaar-e-Tabriz_000521270009.jpg", "Bazaar-e-Tabriz_000521270008.jpg",
("dresden-prague-iran-2024", "Babataher.jpg"),
],
),
(
@@ -60,6 +61,53 @@ collection_groups = [
"Kazakhstan_DSC-0870.jpg", "Kazakhstan_DSC-0865.jpg",
],
),
(
"dresden-prague-iran-2024",
datetime(2024, 10, 9, 23, 50, 59, tzinfo=timezone.utc),
"Dresden & Berlin",
[
"x_000512370028.jpg", "x_000512370027.jpg", "x_000512370026.jpg",
"x_000512370024.jpg", "x_000512370022.jpg", "x_000512370013.jpg",
"x_000512350002.jpg", "x_000512350001.jpg",
"Let-me-tell-you-a-story_000512370015.jpg", "Dresden_000512370034.jpg",
"Dresden_000512370033.jpg", "Dresden_000512370032.jpg",
"Dresden_000512370019.jpg", "Dresden_000512370018.jpg",
"Dresden_000512370017.jpg", "Dresden_000512370016.jpg",
],
),
(
"dresden-prague-iran-2024",
datetime(2024, 10, 9, 23, 40, 59, tzinfo=timezone.utc),
"Iran - Tehran & Qom",
[
"Home_000512360003.jpg", "Somewhere-in-Tehran_2.jpg",
"Somewhere-in-Tehran.jpg", "Grandmother's-old-room.jpg",
],
),
(
"dresden-prague-iran-2024",
datetime(2024, 10, 9, 23, 30, 59, tzinfo=timezone.utc),
"Prague",
[
"x_000512370006.jpg", "x_000512370005.jpg", "x_000512370003.jpg",
"Prague_000512370012.jpg", "Prague_000512360031.jpg",
"Prague_000512360030.jpg", "Prague_000512360029.jpg",
"Prague_000512360027.jpg", "Prague_000512360021.jpg",
"Prague_000512360020.jpg", "Prague_000512360019.jpg",
],
),
(
"dresden-prague-iran-2024",
datetime(2024, 10, 9, 23, 20, 59, tzinfo=timezone.utc),
"Belfast & Tallaght",
[
"x_000512350014.jpg", "x_000512350012.jpg", "x_000512350011.jpg",
"x_000512350006.jpg", "x_000512350004.jpg", "x_000512350003.jpg",
"Bobby-Sands.jpg", "Belfast_000512350032.jpg",
"Belfast_000512350027.jpg", "Belfast_000512350026.jpg",
"Belfast_000512350022.jpg", "Belfast_000512350018.jpg",
],
),
]
anchors = {armenia[0]: "Armenia", romania[0]: "Romania"}
@@ -95,8 +143,9 @@ for position, (job, index) in enumerate(ordered):
target.write_text("\n".join(lines) + "\n")
for folder, group_start, anchor, filenames in collection_groups:
for position, filename in enumerate(filenames):
image = f"/img/arts/{folder}/{filename}"
for position, member in enumerate(filenames):
member_folder, filename = member if isinstance(member, tuple) else (folder, member)
image = f"/img/arts/{member_folder}/{filename}"
matches = [path for path in ART.glob("*.md") if image in path.read_text()]
assert len(matches) == 1, (image, matches)
path = matches[0]
@@ -110,4 +159,4 @@ for folder, group_start, anchor, filenames in collection_groups:
json.dumps(anchor) + "\n", 1)
path.write_text(content)
print("Organized Armenia, Romania, Iran, and Kazakhstan into contiguous highlights")
print("Organized all configured photo highlights into contiguous groups")
+42 -12
View File
@@ -14,8 +14,8 @@ ROMANIA = [f"/img/arts/uploads/{JOB}/{index:02}.jpg" for index in (0, 1)] + [
for index in range(5)] + [
"/img/arts/uploads/260cc99527c13f256d4ea39d0959f5daa942c888ea882852e73fd94f6c30b7db/00.jpg",
"/img/arts/uploads/b18a2f1c7127077c801160782012cb164759f0b9dd41762205b45e4c9a07d673/00.jpg"]
COLLECTIONS = {
"iran-analog-2024": [
COLLECTIONS = [
("Iran - Hamadan, Kermanshah, Tabriz", [
"Taq-e-Bostan_000521270020.jpg", "Taq-e-Bostan_000521270019.jpg",
"Taq-e-Bostan_000521270018.jpg", "Tabriz_000521270013.jpg",
"Tabriz_000521270012.jpg", "Iran_000521270023.jpg",
@@ -26,8 +26,9 @@ COLLECTIONS = {
"Bistoon_000521270027.jpg", "Bistoon_000521270026.jpg",
"Bistoon_000521270025.jpg", "Bazaar-e-Tabriz_000521270010.jpg",
"Bazaar-e-Tabriz_000521270009.jpg", "Bazaar-e-Tabriz_000521270008.jpg",
],
"kazakhstan-2024": [
"Babataher.jpg",
]),
("Kazakhstan - World Nomad Games", [
"x_DSC-0999.jpg", "x_DSC-0994.jpg",
"World-Nomad-Games,-Kazakhstan_DSC-0685.jpg",
"World-Nomad-Games,-Kazakhstan_DSC-0536.jpg",
@@ -35,8 +36,35 @@ COLLECTIONS = {
"World-Nomad-Games,-Kazakhstan_DSC-0298.jpg",
"World-Nomad-Games,-Kazakhstan_DSC-0251.jpg",
"Kazakhstan_DSC-0870.jpg", "Kazakhstan_DSC-0865.jpg",
],
}
]),
("Dresden & Berlin", [
"x_000512370028.jpg", "x_000512370027.jpg", "x_000512370026.jpg",
"x_000512370024.jpg", "x_000512370022.jpg", "x_000512370013.jpg",
"x_000512350002.jpg", "x_000512350001.jpg",
"Let-me-tell-you-a-story_000512370015.jpg", "Dresden_000512370034.jpg",
"Dresden_000512370033.jpg", "Dresden_000512370032.jpg",
"Dresden_000512370019.jpg", "Dresden_000512370018.jpg",
"Dresden_000512370017.jpg", "Dresden_000512370016.jpg",
]),
("Iran - Tehran & Qom", [
"Home_000512360003.jpg", "Somewhere-in-Tehran_2.jpg",
"Somewhere-in-Tehran.jpg", "Grandmother's-old-room.jpg",
]),
("Prague", [
"x_000512370006.jpg", "x_000512370005.jpg", "x_000512370003.jpg",
"Prague_000512370012.jpg", "Prague_000512360031.jpg",
"Prague_000512360030.jpg", "Prague_000512360029.jpg",
"Prague_000512360027.jpg", "Prague_000512360021.jpg",
"Prague_000512360020.jpg", "Prague_000512360019.jpg",
]),
("Belfast & Tallaght", [
"x_000512350014.jpg", "x_000512350012.jpg", "x_000512350011.jpg",
"x_000512350006.jpg", "x_000512350004.jpg", "x_000512350003.jpg",
"Bobby-Sands.jpg", "Belfast_000512350032.jpg", "Belfast_000512350027.jpg",
"Belfast_000512350026.jpg", "Belfast_000512350022.jpg",
"Belfast_000512350018.jpg",
]),
]
class PhotoHighlightTests(unittest.TestCase):
@@ -58,18 +86,20 @@ class PhotoHighlightTests(unittest.TestCase):
self.assertIn("Transmission of Flesh by Erfan Ashourioun", grouped[2][3])
def test_existing_collection_highlight_starts(self):
iran = (ART / "2024-10-25-Taq-e-Bostan_000521270020.md").read_text()
kazakhstan = (ART / "2024-10-09-x_DSC-0999.md").read_text()
self.assertIn('anchor: "Iran - Hamadan, Kermanshah, Tabriz"', iran)
self.assertIn('anchor: "Kazakhstan - World Nomad Games"', kazakhstan)
for anchor, filenames in COLLECTIONS:
first = next(path for path in ART.glob("*.md")
if filenames[0] in path.read_text())
self.assertIn(f'anchor: "{anchor}"', first.read_text())
def test_existing_collection_order_uses_distinct_seconds(self):
for folder, filenames in COLLECTIONS.items():
for _, filenames in COLLECTIONS:
records = []
for path in ART.glob("*.md"):
content = path.read_text()
image = re.search(rf'/img/arts/{folder}/([^\s)"\']+)', content)
image = re.search(r'/img/arts/[^/]+/([^)]+)\)', content)
if image:
if image.group(1) not in filenames:
continue
date = re.search(r'^date: "([^"]+)"', content, re.MULTILINE)
records.append((datetime.fromisoformat(date.group(1)), image.group(1)))
records.sort(reverse=True)