update webmention script
Deploy Website / build (push) Successful in 28s Details

This commit is contained in:
James Ravenscroft 2024-12-23 09:00:20 +00:00
parent a62436ca61
commit e66b5fc968
3 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,3 @@
import uuid
import os import os
import hashlib import hashlib
from datetime import datetime from datetime import datetime
@ -105,8 +104,8 @@ def generate_card(input_file, workspace_path):
if os.path.exists(output_path): if os.path.exists(output_path):
print(f"{output_path} Already exists, using cached image") print(f"{output_path} Already exists, using cached image")
return else:
print(f"Generating card... {output_path}")
hti.temp_path = Path(workspace_path) / "tmp" hti.temp_path = Path(workspace_path) / "tmp"
if not os.path.exists(hti.temp_path): if not os.path.exists(hti.temp_path):
@ -125,7 +124,7 @@ def generate_card(input_file, workspace_path):
old_fin = front_matter["preview"][:8] old_fin = front_matter["preview"][:8]
old_fill_path = Path(workspace_path) / "static" / "social" / old_fin old_fill_path = Path(workspace_path) / "static" / "social" / old_fin
if os.path.exists(old_fill_path): if os.path.exists(old_fill_path) and (old_fill_path != output_path):
print(f"Move {old_fill_path} into cleanup...") print(f"Move {old_fill_path} into cleanup...")
os.rename(old_fill_path, old_fill_path + ".cleanup") os.rename(old_fill_path, old_fill_path + ".cleanup")

View File

@ -65,6 +65,7 @@ def update():
feed: feedparser.FeedParserDict = feedparser.parse(os.environ.get("RSS_URL")) feed: feedparser.FeedParserDict = feedparser.parse(os.environ.get("RSS_URL"))
print(f"Checking for new entries on {os.environ.get('RSS_URL')} since {last_updated}")
for entry in feed["entries"]: for entry in feed["entries"]:
if datetime(*entry["published_parsed"][:6]) > last_updated: if datetime(*entry["published_parsed"][:6]) > last_updated:
links = check_for_links(entry["link"]) links = check_for_links(entry["link"])

View File

@ -1,13 +1,13 @@
{ {
"last_updated": [ "last_updated": [
2024, 2024,
11, 12,
16, 22,
17, 12,
15, 25,
37, 46,
5, 6,
321, 357,
0 0
] ]
} }