diff --git a/konfluks/feed.py b/konfluks/feed.py index 08606d2..53435ba 100644 --- a/konfluks/feed.py +++ b/konfluks/feed.py @@ -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!")