do proper deletion

This commit is contained in:
rra 2024-11-06 17:24:55 +01:00
parent e01aa9a607
commit 9d9f8f6d72

View File

@ -374,16 +374,16 @@ def main():
data = grab_feed(feed_url)
if data:
opds_feed = False
if 'links' in data.feed:
for i in data.feed['links']:
if i['rel'] == 'self':
if 'opds' in i['type']:
opds_feed = True
print("OPDS type feed!")
if data: #whenever we get a 200
if data.feed: #only if it is an actual feed
opds_feed = False
if 'links' in data.feed:
for i in data.feed['links']:
if i['rel'] == 'self':
if 'opds' in i['type']:
opds_feed = True
print("OPDS type feed!")
if data.feed:
for entry in data.entries:
# if 'tags' in entry:
# for tag in entry.tags:
@ -423,14 +423,15 @@ def main():
else:
create_post(post_dir, entry)
existing_posts.remove(
post_dir
post_name
) # create list of posts which have not been returned by the feed
for post in existing_posts:
# remove blog posts no longer returned by the RSS feed
print("deleted", post)
shutil.rmtree(post)
post_dir = os.path.join(output_dir, feed_name, post)
shutil.rmtree(post_dir)
print("deleted", post_dir)
else:
print(feed_url, "is not or no longer a feed!")