commit 6ccdb684ec2c5ad6c4668f287e109ff8c84c1083 Author: Nora Goodman Date: Thu May 22 18:03:28 2025 -0400 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..265b088 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +scraper/ +.venv/ +__pycache__/ +posts/ \ No newline at end of file diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..3e9ca27 Binary files /dev/null and b/assets/logo.png differ diff --git a/blog.html b/blog.html new file mode 100644 index 0000000..63b2d71 --- /dev/null +++ b/blog.html @@ -0,0 +1,164 @@ + + + + + + Rochester Food Not Bombs + + + + + + + + + +

Blog not bombs ;)

+
+ +
+ + post image from Feb 10, '25 +

Feb 10, '25

+
+
+ +
+ + post image from Feb  9, '25 +

Feb 9, '25

+
+
+ +
+ + post image from Feb  9, '25 +

Feb 9, '25

+
+
+ +
+ + post image from Feb  6, '25 +

Feb 6, '25

+
+
+ +
+ + post image from Feb  5, '25 +

Feb 5, '25

+
+
+ +
+ + post image from Feb  3, '25 +

Feb 3, '25

+
+
+ +
+ + post image from Feb  2, '25 +

Feb 2, '25

+
+
+ +
+ + post image from Jan 31, '25 +

Jan 31, '25

+
+
+ +
+ + post image from Jan 29, '25 +

Jan 29, '25

+
+
+ +
+ + post image from Jan 27, '25 +

Jan 27, '25

+
+
+ +
+ + post image from Jan 26, '25 +

Jan 26, '25

+
+
+ +
+ + post image from Jan 24, '25 +

Jan 24, '25

+
+
+ +
+ + post image from Jan 23, '25 +

Jan 23, '25

+
+
+ +
+ + post image from Jan 22, '25 +

Jan 22, '25

+
+
+ +
+ + post image from Jan 21, '25 +

Jan 21, '25

+
+
+ +
+ + post image from Jan 21, '25 +

Jan 21, '25

+
+
+ +
+ + post image from Jan 20, '25 +

Jan 20, '25

+
+
+ +
+ + post image from Jan 19, '25 +

Jan 19, '25

+
+
+ +
+ + post image from Jan 19, '25 +

Jan 19, '25

+
+
+ +
+ + + + \ No newline at end of file diff --git a/builder.py b/builder.py new file mode 100644 index 0000000..33aa8c5 --- /dev/null +++ b/builder.py @@ -0,0 +1,66 @@ +import lzma +import json +import os +import re +from pytz import timezone +from datetime import datetime +import bisect +from jinja2 import Environment, PackageLoader, select_autoescape + +scraper_path = 'scraper/' +output_path='./' + +env = Environment( + loader=PackageLoader("builder"), + autoescape=select_autoescape() +) +blog_template = env.get_template("blog_template.html") +post_template=env.get_template("post.html") + +posts = [] + +for folder in os.listdir(scraper_path): + if os.path.isdir(os.path.join(scraper_path, folder)): + post = {'pictures': []} + for file in os.listdir(scraper_path + folder): + if file.endswith('.xz'): + if file.endswith('.xz'): + with lzma.open(scraper_path + folder + '/' + file) as f: + json_bytes = f.read() + stri = json_bytes.decode('utf-8') + data = json.loads(stri) + # checks that we're looking at a downloaded post, not the profile picture or something + if 'node' in data.keys() and 'date' in data['node'].keys(): + timestamp = data['node']['date'] + post['timestamp'] = timestamp #useful for sorting + post['datetime'] = datetime.fromtimestamp(data['node']['date'], timezone("America/New_York")).strftime("%b %e, '%y") + # use negative timestamp because that's the easiest way to sort from high to low + bisect.insort_right(posts, post, key=lambda t: -t['timestamp']) + if file.endswith('.webp') or file.endswith('.jpg'): + filepath=os.path.join(scraper_path, folder, file) + def get_index(t:str): + extension_len = 6 + if t.endswith('.jpg'): + extension_len = 5 + lastpart = filepath[filepath.rfind('_'):-extension_len] # will get the index of the image within the post if more than one + if lastpart.isdigit(): + return int(lastpart) + else: + return 0 + bisect.insort_left(post['pictures'], filepath, key=get_index) + if file.endswith('.txt'): + filepath=os.path.join(scraper_path, folder, file) + with open(filepath, 'r') as file: + post['caption'] = file.read() + + if ('timestamp' in post.keys()): + with open(output_path + 'posts/' + str(post['timestamp']) +'.html', 'w+') as output_file: + output_file.write(post_template.render(post=post)) + +homepage_template = env.get_template("index.html") + +with open(output_path + 'index.html', "w+") as output_file: + output_file.write(homepage_template.render()) + +with open(output_path + 'blog.html', "w+") as output_file: + output_file.write(blog_template.render(posts=posts)) \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..d107104 --- /dev/null +++ b/index.html @@ -0,0 +1,77 @@ + + + + + + Rochester Food Not Bombs + + + + + + + + + + +

Rochester Food Not Bombs!

+Solidarity not charity: From Rochester, New York. +

Free hot meals are served every Saturday at 6:30PM in front of the RTS Transit Center on St. Paul.

+

Help us cook every Saturday at 4PM at the Flying Squirrel Community Space. +

+
+ +
+

Quick resources

+ +
+ +
+

Rochester Food Not Bombs recovers resources to create free vegetarian and vegan meals in our local + community. + We + are a decentralized all-volunteer run group, with no hierarchy or formal leaders, making decisions based + on + consensus.

+

+ We recognize poverty as a form of violence, and think access to food should be viewed as a right, rather + than a + privilege. In this practice, we strive to reduce waste by turning donated food into productive meals. We + source + food from vendors at the Public Market, as well as relying on donations. Food should be a source of + nutrition + for + people, not profit under capitalism. Through Community organizing and outreach, we support other local + and + national peace and justice groups to create a broader sense of social responsibility -- If you would + like to + get + involved, please reach out to us! +

+
+
+

See what we're up to :-)

+ + + + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..535683e --- /dev/null +++ b/style.css @@ -0,0 +1,65 @@ +body { + background-color: #EEEEEE; + text-align: center; +} + +#resources-list { + text-align: left; +} +.flex-container { + display: flex; + flex-wrap: wrap; + margin: auto; + align-items: center; + justify-content: center; +} + +.fancy-border { + border-width: 0.2em; + border-style: ridge; + border-radius: 1em; +} +#resources-box { + width: 20em; + border-color: #b9539f; + margin: auto; + margin-left: 1rem; + margin-right: 1rem; + margin-top: 2rem; + padding: 1em; +} +#blurb { + width: 40em; + border-color: #f27322; + margin: auto; + margin-top: 2rem; + margin-left: 1rem; + margin-right: 1rem; + text-align: left; + padding: 1em 2em 1em 2em; +} +:is(h1, h2, h3, h4, h5, h6) { + font-family: "Teko", serif; + font-optical-sizing: auto; + font-style: normal; +} + +@keyframes logospin { + from { + transform: rotate(-2turn); + } + to { + transform: rotate(0); + } +} + +.spinny { + animation-name: logospin; + animation-duration: 2s; +} + +.post-container{ + padding: 0.5rem; + margin: 0.5rem; + border-color: black; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..682d919 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,27 @@ + + + + + + Rochester Food Not Bombs + + + + + + + + + {% block content %} + {% endblock %} + + + \ No newline at end of file diff --git a/templates/blog_template.html b/templates/blog_template.html new file mode 100644 index 0000000..6e703c0 --- /dev/null +++ b/templates/blog_template.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% block content %} +

Blog not bombs ;)

+
+ {% for post in posts %} +
+ + post image from {{ post['datetime'] }} +

{{ post['datetime'] }}

+
+
+ {% endfor %} +
+{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..9400839 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,53 @@ +{% extends "base.html" %} +{% block content %} + +

Rochester Food Not Bombs!

+Solidarity not charity: From Rochester, New York. +

Free hot meals are served every Saturday at 6:30PM in front of the RTS Transit Center on St. Paul.

+

Help us cook every Saturday at 4PM at the Flying Squirrel Community Space. +

+
+ +
+

Quick resources

+ +
+ +
+

Rochester Food Not Bombs recovers resources to create free vegetarian and vegan meals in our local + community. + We + are a decentralized all-volunteer run group, with no hierarchy or formal leaders, making decisions based + on + consensus.

+

+ We recognize poverty as a form of violence, and think access to food should be viewed as a right, rather + than a + privilege. In this practice, we strive to reduce waste by turning donated food into productive meals. We + source + food from vendors at the Public Market, as well as relying on donations. Food should be a source of + nutrition + for + people, not profit under capitalism. Through Community organizing and outreach, we support other local + and + national peace and justice groups to create a broader sense of social responsibility -- If you would + like to + get + involved, please reach out to us! +

+
+
+

See what we're up to :-)

+{% endblock %} \ No newline at end of file diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..cd86418 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} +{% block content %} +

{{ post['datetime'] }}

+{% for paragraph in post['caption'].split('\n') %} +

{{ paragraph }}

+{% endfor %} + + + +{% endblock %} \ No newline at end of file diff --git a/templates/rss.xml b/templates/rss.xml new file mode 100644 index 0000000..c354d24 --- /dev/null +++ b/templates/rss.xml @@ -0,0 +1,10 @@ + + + Rochester Food Not Bombs + https://rocfoodnotbombs.com/blog.html + + Updates on the Rochester Food not Bombs chapter, automatically mirrored from Instagram. + + en-us + {{ date }} + {% for %} \ No newline at end of file