Adjusted height of image and fixed whitespace bug

This commit is contained in:
emma 2024-10-01 06:06:33 -04:00
parent 9e3e5f8d29
commit 0ed4ae198c
5 changed files with 23 additions and 18 deletions

View File

@ -23,7 +23,7 @@
</header>
<main>
<!-- a more descriptive alt text is not possible, I can only know ahead of time that one or more catss will be in the image -->
<img class = "cat-img" src=img/cat2024-08-23-23:47:58.jpg alt="A picture of a cat">
<img class = "cat-img" src=img/cat2024-10-01-06:00:03.jpg alt="A picture of a cat">
</main>
<footer>
<p>Made by <a href="https://zepp.omg.lol" target="_blank" rel="noopener noreferrer">zepp</a> for the love of cats. </p>

20
main.py
View File

@ -61,13 +61,15 @@ def update_html_img_tag(index):
old_img_tag = ""
tag_list = []
with open(index, "r") as f:
tag_list = f.readlines()
for tag in tag_list:
if "<img" in tag:
old_img_tag += tag
index_file = f.read()
element_list = index_file.split('\n')
items = ""
for el in element_list:
if "<img" in el:
items += el
split_img_element = old_img_tag.split(" ")
split_img_element = items.split(" ")
time = datetime.datetime.today()
time = str(time).strip()
for i in range(0, len(split_img_element)):
@ -79,11 +81,11 @@ def update_html_img_tag(index):
img_element_as_list = in_progress_img_tag.split(" ")
new_img_tag = " ".join(img_element_as_list)
html = " ".join(tag_list)
html = html.replace(old_img_tag, new_img_tag)
index_file = index_file.replace(items, new_img_tag)
with open(index, "w") as f:
f.write(html)
f.write(index_file)
def main():
update_html_img_tag("index.html")

10
rss.xml
View File

@ -5,14 +5,14 @@
<link>https://onecatper.day</link>
<description>Source page: https://onecatper.day</description>
<language>en</language>
<lastBuildDate>Fri, 23 Aug 2024 23:47:59 -0500</lastBuildDate>
<lastBuildDate>Tue, 01 Oct 2024 05:46:31 -0500</lastBuildDate>
<item>
<title>One cat per day!</title>
<link>https://onecatper.day#92284792381514554275859380843050</link>
<link>https://onecatper.day#98277929033324946536005614106589</link>
<description>One cat per day!</description>
<pubDate>Fri, 23 Aug 2024 23:47:59 -0500</pubDate>
<guid isPermaLink="false">https://onecatper.day#28256203148750911037226073239732</guid>
<enclosure length="1000000" type="image/jpeg" url="https://onecatper.day/img/cat2024-08-23-23:47:58.jpg"/>
<pubDate>Tue, 01 Oct 2024 05:46:31 -0500</pubDate>
<guid isPermaLink="false">https://onecatper.day#48930374247138023033213881531490</guid>
<enclosure length="1000000" type="image/jpeg" url="https://onecatper.day/img/cat2024-10-01-05:46:31.jpg"/>
</item>
</channel>
</rss>

View File

@ -1,7 +1,5 @@
from random import randint
import datetime
# might as well use the datetime we made in main.py for consistency
from main import DATETIME_STR
# updates the guid given in two places with the RSS file, essential for letting readers know
# a new picture has been published
@ -11,6 +9,11 @@ from main import DATETIME_STR
# also updates pubDate and lastBuildDate
# finally, updates the image name as well
# this will change between calls due to microseconds
# better for it just to be a global
DATETIME_STR = str(datetime.datetime.today()).replace(' ', "-")
# we don't need those pesky microseconds any way
DATETIME_STR = DATETIME_STR[:-7]
def update_rss_feed(rss_file_name):
rss_file = ""

View File

@ -73,7 +73,7 @@ main {
.cat-img {
margin: 3px;
height: 500px;
height: 450px;
width: auto;
border-radius: 10px;
border: 5px solid #6d5a8c;