update webmention script
Deploy Website / build (push) Successful in 28s
Details
Deploy Website / build (push) Successful in 28s
Details
This commit is contained in:
parent
a62436ca61
commit
e66b5fc968
|
@ -1,4 +1,3 @@
|
||||||
import uuid
|
|
||||||
import os
|
import os
|
||||||
import hashlib
|
import hashlib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -105,27 +104,27 @@ 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):
|
||||||
|
os.mkdir(hti.temp_path)
|
||||||
|
|
||||||
if not os.path.exists(hti.temp_path):
|
files = hti.screenshot(
|
||||||
os.mkdir(hti.temp_path)
|
html_str=[parsed_html], save_as=file_name, size=[(1128, 600)]
|
||||||
|
)
|
||||||
|
|
||||||
files = hti.screenshot(
|
# move from tmp location to workspace folder
|
||||||
html_str=[parsed_html], save_as=file_name, size=[(1128, 600)]
|
output_path = output_path.absolute().as_posix()
|
||||||
)
|
os.rename(files[0], output_path)
|
||||||
|
|
||||||
# move from tmp location to workspace folder
|
|
||||||
output_path = output_path.absolute().as_posix()
|
|
||||||
os.rename(files[0], output_path)
|
|
||||||
|
|
||||||
if "preview" in front_matter:
|
if "preview" in front_matter:
|
||||||
# strip '/social/' from the existing preview value
|
# strip '/social/' from the existing preview value
|
||||||
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")
|
||||||
|
|
||||||
|
|
|
@ -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"])
|
||||||
|
|
|
@ -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
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue