Browse Source

replacing works, but remote url was used in stead of remote when there already was an image. Fixes #5

master
rra 3 years ago
parent
commit
17d7faac4d
  1. 4
      rss_aggregator.py

4
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 with open(os.path.join(post_dir,'index.html'),'w') as f: #n.b. .html
post = template.render(frontmatter=frontmatter, content=parsed_content) post = template.render(frontmatter=frontmatter, content=parsed_content)
f.write(post) 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): def grab_media(post_directory, url):
""" """
@ -117,6 +117,8 @@ def grab_media(post_directory, url):
print('Downloaded cover image', image) print('Downloaded cover image', image)
return image return image
return image return image
elif os.path.exists(os.path.join(post_directory, image)):
return image
except Exception as e: except Exception as e:
print('Failed to download cover image', url) print('Failed to download cover image', url)

Loading…
Cancel
Save