From ec98975f926524197ed599ddb47231d0468250b8 Mon Sep 17 00:00:00 2001 From: petrus comestor Date: Tue, 29 Oct 2024 18:40:54 -0400 Subject: auto --- generate-schedule.py | 155 ++++++++++++++++++++++++++++++ index.base | 58 ++++++++++++ index.html | 260 +++++++++++++++++++++++++++++++++++---------------- static/styles.css | 26 ++++-- 4 files changed, 411 insertions(+), 88 deletions(-) create mode 100755 generate-schedule.py create mode 100644 index.base diff --git a/generate-schedule.py b/generate-schedule.py new file mode 100755 index 0000000..1541ca6 --- /dev/null +++ b/generate-schedule.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 + +from datetime import date +from dataclasses import dataclass +import calendar + +@dataclass +class Location: + name: str + url: str + neighborhood: str + time: str = None + info: str = None + +@dataclass +class Event: + location: Location + when: date + time: str = None + info: str = None + special: bool = False + cancelled: bool = False + +def render_schedule(events): + s = '' + week = None + for event in events: + weekday = calendar.day_name[event.when.weekday()] + month = calendar.month_name[event.when.month] + day = event.when.day + time = event.time or event.location.time + assert time, 'no time given either in location or event' + info = event.info or event.location.info + infotxt = f'
{info}
' if info else '' + + week_change = False + new_week = event.when.isocalendar()[1] + if week is not None and week != new_week: + week_change = True + week = new_week + + if week_change: + s += '
\n' + s += f'''
+
+ {weekday}, {month} {day} · {time} +
+
+ {event.location.name}, + {event.location.neighborhood} + {infotxt} +
+
''' + + return s + +mccarren = Location( + "Spritzenhaus33", + "https://maps.app.goo.gl/4jKTTTJ3h61dGPyz6", + "Williamsburg", + "6:30p", +) + +jefferson = Location( + "Jefferson Market Library", + "https://maps.app.goo.gl/UTNUqUdEjYCssiMx5", + "Greenwich Village", + "6p", + info="1st floor Willa Cather Room; take a left at entrance, straight through children’s room" +) + +nook = Location( + "Nook", + "https://maps.app.goo.gl/X2fYE3EpeHhQhgYD8", + "Bushwick", + "9a", +) + +liz = Location( + "Liz’s Book Bar", + "https://maps.app.goo.gl/6hgstJRcd2TKa96x5", + "Carroll Gardens", + "7p", +) + +abraco = Location( + "Abraço", + "https://maps.app.goo.gl/6w6GzymLNy9vdgqG9", + "East Village", + "6p", +) + +bookclub = Location( + "Book Club Bar", + "https://maps.app.goo.gl/ewGbWuEjp7cedMrb7", + "East Village", + "9p", +) + +dekalblibrary = Location( + "Dekalb Library", + "https://maps.app.goo.gl/G3D2hQ6og5DkBQH86", + "Bushwick", +) + +wyckoffbondgarden = Location( + "Wyckoff-Bond Community Garden", + "https://maps.app.goo.gl/qWKXJhrvvpvLeFLy7", + "Boerum Hill", + info="Hosted by Carroll Gardens Library" +) + +bkcentrallibrary = Location( + "Brooklyn Central Library", + "https://maps.app.goo.gl/fPijDbTN47TbFpFf6", + "Prospect Heights", + info="Trustees Room" +) + +bushwicklibrary = Location( + "Bushwick Library", + "https://maps.app.goo.gl/2mnX1sDSrBv1jKQ3A", + "Bushwick", +) + +schedule = [ + Event(jefferson, date(2024, 10, 30)), + Event(nook, date(2024, 11, 2)), + Event(bookclub, date(2024, 11, 3)), + Event(mccarren, date(2024, 11, 4), info='Book Swap and NYC Books Through Bars Book Drive.', special=True), + Event(jefferson, date(2024, 11, 6), info='Elevator in lobby to third floor. Book Swap and NYC Books Through Bars Book Drive.', special=True), + Event(nook, date(2024, 11, 9)), + Event(mccarren, date(2024, 11, 11)), + Event(abraco, date(2024, 11, 13), special=True, info='Wednesday Jefferson Market Library Quiet Reading moved for this week.'), + Event(bushwicklibrary, date(2024, 11, 14), time='6p', special=True), + Event(nook, date(2024, 11, 16)), + Event(wyckoffbondgarden, date(2024, 11, 16), time='12p', special=True), + Event(mccarren, date(2024, 11, 18)), + Event(jefferson, date(2024, 11, 20)), + Event(bkcentrallibrary, date(2024, 11, 20), time='6:30p', special=True), + Event(dekalblibrary, date(2024, 11, 21), time='6p', special=True), + Event(nook, date(2024, 11, 23)), + Event(mccarren, date(2024, 11, 25)), + Event(jefferson, date(2024, 11, 27), info='Cancelled due to Thanksgiving.', cancelled=True), + Event(nook, date(2024, 11, 30)), + # Event(bookclub, date(2024, 12, 1)), + # Event(liz, date(2024, 12, 3)), +] # maybe autosort it and sort code by event? + +with open('index.base') as base: + txt = base.read() + html = render_schedule(schedule) + txt = txt.replace('{SCHEDULE}', html) + with open('index.html', 'w') as index: + index.write(txt) diff --git a/index.base b/index.base new file mode 100644 index 0000000..68a5d13 --- /dev/null +++ b/index.base @@ -0,0 +1,58 @@ + + + + Quiet Reading + + + + + + +
+
+ +
+
+ Free weekly events in
libraries, parks, and cafes.
+
+
+ One reading hour. One social hour.
Bring your own book, make a new friend! +
+
+ +
+
+
+ + {SCHEDULE} + +
+
+
+

+ Bring your own book, read for one hour, and then chat + for one hour about books, literature, and arts. +

+

+ No registration: just show up with a good book!
For park events, you can bring a blanket as well. +

+
+
+
+ + + + +
+
+ + + diff --git a/index.html b/index.html index b634d5d..2c50c0f 100644 --- a/index.html +++ b/index.html @@ -31,88 +31,184 @@


-
-
- Mondays, 6:30p -
- - Spritzenhaus33 -
- Williamsburg - - - - - -
-
- Next:
October 28, November 4… - - - - -
-
-
-
-
- 1st Tuesday/month, 7p -
- Liz’s Book Bar -
- Carroll Gardens -
-
- Next: -
- December 3… -
11/5 date cancelled. -
-
-
-
-
- Wednesdays, 6p -
- Jefferson Market Library -
- Greenwich Village -
- First floor Willa Cather Room -
-
-
- Next:
October 30, November 6… -
- Note: Meet on the third floor on 11/6; not the first floor. -
-
-
-
-
- Saturdays, 9a -
- Nook -
- Bushwick -
-
- Next:
October 26, November 2… -
-
-
-
-
- 1st Sunday/month, 9p -
- Book Club Bar -
- East Village -
-
- Next:
November 3, December 1… -
-
+ +
+
+ Wednesday, October 30 · 6p +
+
+ Jefferson Market Library, + Greenwich Village +
1st floor Willa Cather Room; take a left at entrance, straight through children’s room
+
+
+
+ Saturday, November 2 · 9a +
+
+ Nook, + Bushwick + +
+
+
+ Sunday, November 3 · 9p +
+
+ Book Club Bar, + East Village + +
+

+
+
+ Monday, November 4 · 6:30p +
+
+ Spritzenhaus33, + Williamsburg +
Book Swap and NYC Books Through Bars Book Drive.
+
+
+
+ Wednesday, November 6 · 6p +
+
+ Jefferson Market Library, + Greenwich Village +
Elevator in lobby to third floor. Book Swap and NYC Books Through Bars Book Drive.
+
+
+
+ Saturday, November 9 · 9a +
+
+ Nook, + Bushwick + +
+

+
+
+ Monday, November 11 · 6:30p +
+
+ Spritzenhaus33, + Williamsburg + +
+
+
+ Wednesday, November 13 · 6p +
+
+ Abraço, + East Village +
Wednesday Jefferson Market Library Quiet Reading moved for this week.
+
+
+
+ Thursday, November 14 · 6p +
+
+ Bushwick Library, + Bushwick + +
+
+
+ Saturday, November 16 · 9a +
+
+ Nook, + Bushwick + +
+
+
+ Saturday, November 16 · 12p +
+
+ Wyckoff-Bond Community Garden, + Boerum Hill +
Hosted by Carroll Gardens Library
+
+

+
+
+ Monday, November 18 · 6:30p +
+
+ Spritzenhaus33, + Williamsburg + +
+
+
+ Wednesday, November 20 · 6p +
+
+ Jefferson Market Library, + Greenwich Village +
1st floor Willa Cather Room; take a left at entrance, straight through children’s room
+
+
+
+ Wednesday, November 20 · 6:30p +
+
+ Brooklyn Central Library, + Prospect Heights +
Trustees Room
+
+
+
+ Thursday, November 21 · 6p +
+
+ Dekalb Library, + Bushwick + +
+
+
+ Saturday, November 23 · 9a +
+
+ Nook, + Bushwick + +
+

+
+
+ Monday, November 25 · 6:30p +
+
+ Spritzenhaus33, + Williamsburg + +
+
+
+ Wednesday, November 27 · 6p +
+
+ Jefferson Market Library, + Greenwich Village +
Cancelled due to Thanksgiving.
+
+
+
+ Saturday, November 30 · 9a +
+
+ Nook, + Bushwick + +
+
+

diff --git a/static/styles.css b/static/styles.css index 4d486d6..a524ed1 100644 --- a/static/styles.css +++ b/static/styles.css @@ -125,7 +125,7 @@ a:hover { .event { border: 1px darkslategrey dotted; - border-radius: 10px; + /* border-radius: 10px; */ padding: 1em; padding-top: .6em; display: grid; @@ -133,7 +133,7 @@ a:hover { gap: 1em; align-items: center; justify-items: end; - max-width: 500px; + max-width: 550px; margin: 0 auto; } @@ -152,10 +152,10 @@ a:hover { .instance { text-align: right; - border: 1px darkslategrey dotted; - border-radius: 5px; - padding: .6em; - padding-top: .2em; + /* border: 1px darkslategrey dotted; */ + /* border-radius: 5px; */ + /* padding: .6em; */ + /* padding-top: .2em; */ width: fit-content; } @@ -199,12 +199,26 @@ hr { } .neighborhood { + letter-spacing: -1px; font-size: 90%; font-style: italic; } +.info { + font-size: 80%; +} + .about { max-width: 40ch; text-align: center; margin: auto; } + +.special { + background: #f3ddff; +} + +.cancelled { + background: #fdd; +} + -- cgit v1.2.3