From 17d7faac4d8baca01ca3f89711ed5024d9ea2231 Mon Sep 17 00:00:00 2001 From: rra Date: Thu, 23 Sep 2021 20:09:44 +0200 Subject: [PATCH] replacing works, but remote url was used in stead of remote when there already was an image. Fixes #5 --- rss_aggregator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rss_aggregator.py b/rss_aggregator.py index 4731686..0e49e30 100644 --- a/rss_aggregator.py +++ b/rss_aggregator.py @@ -98,7 +98,7 @@ def create_post(post_dir, entry): with open(os.path.join(post_dir,'index.html'),'w') as f: #n.b. .html post = template.render(frontmatter=frontmatter, content=parsed_content) f.write(post) - #print('created post for', entry.title, '({})'.format(entry.link)) + print('created post for', entry.title, '({})'.format(entry.link)) def grab_media(post_directory, url): """ @@ -117,6 +117,8 @@ def grab_media(post_directory, url): print('Downloaded cover image', image) return image return image + elif os.path.exists(os.path.join(post_directory, image)): + return image except Exception as e: print('Failed to download cover image', url)