Skip to content

Commit ba583f1

Browse files
author
dalj8690
committed
Updated script for generating RSS feeds
1 parent 1ed1f67 commit ba583f1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

generate_rss.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ def write_rss_feed(file_path, tree, channel):
7878
root = tree.getroot()
7979
channel = root.find("channel")
8080
existing_items = {
81-
item.find("link").text: item for item in channel.findall("item")
81+
item.find("link").text: item
82+
for item in channel.findall("item")
8283
}
84+
if not existing_items:
85+
print("The existing_items dictionary is empty.")
8386
except ET.ParseError:
8487
print("Error parsing the existing RSS file. The file might be corrupted.")
8588
exit(1)
@@ -97,8 +100,9 @@ def write_rss_feed(file_path, tree, channel):
97100
# Process each PDF file
98101
for pdf in sorted(pdf_files):
99102
relative_path = os.path.relpath(pdf, docs_folder)
103+
relative_path = relative_path.replace(os.sep, "/") # Normalize to URL format
100104
link = f"https://github.com/damirlj/modern_cpp_tutorials/blob/main/{relative_path}"
101-
105+
102106
# Check if the item already exists
103107
if link in existing_items:
104108
item = existing_items[link]

0 commit comments

Comments
 (0)