Skip to content

Commit

Permalink
Update rss.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev authored Jan 16, 2024
1 parent 73f624d commit 87fb076
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
START_ENTRY = "_start.md"
END_ENTRY = "_end.md"


def add_entry(feed: FeedGenerator, filename: str):
print(f"Adding entry for file: {filename}")

start_time = time.time()

with open(f"{DATA_DIR}/{filename}", "r") as f:
md_content = f.read()
html_content = markdown.markdown(md_content, extensions=["markdown.extensions.tables"])
Expand All @@ -19,9 +22,11 @@ def add_entry(feed: FeedGenerator, filename: str):
fe.title(formatted_filename)
fe.link(href=f"https://free-for.life/#/?id={formatted_filename}")
fe.description(html_content)

end_time = time.time()
print(f"Added entry for file: {filename} in {end_time - start_time} seconds.")


def main():
start_time = time.time()
fg = FeedGenerator()
Expand All @@ -43,9 +48,12 @@ def main():
add_entry(fg, START_ENTRY)

fg.rss_file(RSS_PATH)

end_time = time.time()

print(f"RSS feed generated and saved to: {RSS_PATH} in {end_time - start_time} seconds.")


if __name__ == "__main__":
print("Starting script...")
main()
Expand Down

0 comments on commit 87fb076

Please sign in to comment.