add more checks for failures

This commit is contained in:
rra 2022-06-01 05:51:25 +02:00
parent 9c824fcd3f
commit ad591ea9cf

View File

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