Merge branch 'new-taxonomy'

This commit is contained in:
knoflook 2024-11-07 16:35:18 +01:00
commit 82a017f624

View File

@ -156,7 +156,8 @@ def parse_enclosures(post_dir, entry):
print("found enclosed media", e.type) print("found enclosed media", e.type)
if "image/" in e.type: if "image/" in e.type:
featured_image = grab_media(post_dir, e.href) featured_image = grab_media(post_dir, e.href)
entry["featured_image"] = featured_image media_item = urlparse(e.href).path.split('/')[-1]
entry["featured_image"] = media_item
else: else:
print("FIXME:ignoring enclosed", e.type) print("FIXME:ignoring enclosed", e.type)
return entry return entry
@ -373,16 +374,16 @@ def main():
data = grab_feed(feed_url) data = grab_feed(feed_url)
if data: if data: #whenever we get a 200
if data.feed: #only if it is an actual feed
opds_feed = False opds_feed = False
if 'links' in data.feed:
for i in data.feed['links']: for i in data.feed['links']:
if i['rel'] == 'self': if i['rel'] == 'self':
if 'opds' in i['type']: if 'opds' in i['type']:
opds_feed = True opds_feed = True
print("OPDS type feed!") print("OPDS type feed!")
for entry in data.entries: for entry in data.entries:
# if 'tags' in entry: # if 'tags' in entry:
# for tag in entry.tags: # for tag in entry.tags:
@ -425,10 +426,14 @@ def main():
post_name post_name
) # create list of posts which have not been returned by the feed ) # create list of posts which have not been returned by the feed
for post in existing_posts: for post in existing_posts:
# remove blog posts no longer returned by the RSS feed # remove blog posts no longer returned by the RSS feed
print("deleted", post) post_dir = os.path.join(output_dir, feed_name, post)
shutil.rmtree(os.path.join(feed_dir, slugify(post))) shutil.rmtree(post_dir)
print("deleted", post_dir)
else:
print(feed_url, "is not or no longer a feed!")
end = time.time() end = time.time()