forked from ruangrupa/konfluks
do proper deletion
This commit is contained in:
parent
e01aa9a607
commit
9d9f8f6d72
@ -374,16 +374,16 @@ def main():
|
|||||||
|
|
||||||
data = grab_feed(feed_url)
|
data = grab_feed(feed_url)
|
||||||
|
|
||||||
if data:
|
if data: #whenever we get a 200
|
||||||
opds_feed = False
|
if data.feed: #only if it is an actual feed
|
||||||
if 'links' in data.feed:
|
opds_feed = False
|
||||||
for i in data.feed['links']:
|
if 'links' in data.feed:
|
||||||
if i['rel'] == 'self':
|
for i in data.feed['links']:
|
||||||
if 'opds' in i['type']:
|
if i['rel'] == 'self':
|
||||||
opds_feed = True
|
if 'opds' in i['type']:
|
||||||
print("OPDS type feed!")
|
opds_feed = True
|
||||||
|
print("OPDS type feed!")
|
||||||
|
|
||||||
if data.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:
|
||||||
@ -423,14 +423,15 @@ def main():
|
|||||||
else:
|
else:
|
||||||
create_post(post_dir, entry)
|
create_post(post_dir, entry)
|
||||||
existing_posts.remove(
|
existing_posts.remove(
|
||||||
post_dir
|
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(post)
|
shutil.rmtree(post_dir)
|
||||||
|
print("deleted", post_dir)
|
||||||
else:
|
else:
|
||||||
print(feed_url, "is not or no longer a feed!")
|
print(feed_url, "is not or no longer a feed!")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user