"
elif file_extension == 'pdf':
html_content += f""
elif file_extension in ['png', 'jpg', 'jpeg', 'gif']:
compressed_image_path = os.path.join(compressed_path, f"compressed_{filename}")
compress_image(file_path, compressed_image_path)
html_content += f""
compressed_files_to_keep.add(compressed_image_path)
elif file_extension in ['mp4', 'avi', 'mov', 'mkv']:
compressed_video_path = os.path.join(compressed_path, f"compressed_{filename}")
compress_video(file_path, compressed_video_path)
html_content += f""
compressed_files_to_keep.add(compressed_video_path)
# Remove compressed files that no longer have a source file in the garden directory
for compressed_file in os.listdir(compressed_path):
compressed_file_path = os.path.join(compressed_path, compressed_file)
if compressed_file_path not in compressed_files_to_keep:
os.remove(compressed_file_path)
# Read footer content
footer_content = read_file(os.path.join(misc_path, 'footer.md'))
footer_html = markdown.markdown(footer_content)
html_content += f""
return html_content
# Generate the final HTML
final_html = f"""
{website_title}
{generate_html()}
"""
# Save the final HTML to a file
with open('website/index.html', 'w', encoding='utf-8') as file:
file.write(final_html)
print("Website generated successfully!")