handle feeds with enclosures (featured media / podcasts) #35

Merged
r merged 5 commits from r/konfluks:master into master 2022-06-01 06:05:37 +00:00
1 changed files with 13 additions and 9 deletions
Showing only changes of commit ad591ea9cf - Show all commits

View File

@ -152,10 +152,13 @@ def parse_enclosures(post_dir, entry):
#TODO handle the fact it could be multiple items
for e in entry.enclosures:
print("found enclosed media", e.type)
if "image/" in e.type:
featured_image = grab_media(post_dir, e.href)
entry["featured_image"] = featured_image
if "type" in e:
print("found enclosed media", e.type)
if "image/" in e.type:
featured_image = grab_media(post_dir, e.href)
entry["featured_image"] = featured_image
else:
print("FIXME:ignoring enclosed", e.type)
return entry
@ -267,11 +270,12 @@ def grab_feed(feed_url):
print(e)
return False
print(data.status, feed_url)
if data.status == 200:
# 304 means the feed has not been modified since we last checked
write_etag(feed_name, data)
return data
if "status" in data:
print(data.status, feed_url)
if data.status == 200:
# 304 means the feed has not been modified since we last checked
write_etag(feed_name, data)
return data
return False
def create_opds_post(post_dir, entry):