From ceaaa8aec06eda52feef7e50c3847b4ee1ef3692 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Jul 2024 20:38:12 +0100 Subject: [PATCH] Less indentation --- newswire.py | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/newswire.py b/newswire.py index 3c6f4c07e..47717e5dd 100644 --- a/newswire.py +++ b/newswire.py @@ -871,27 +871,29 @@ def _xml2str_to_dict(base_dir: str, domain: str, xml_str: str, unique_string_identifier = title + ' ' + link pub_date_str = parse_feed_date(pub_date, unique_string_identifier) - if pub_date_str: - if _valid_feed_date(pub_date_str): - post_filename = '' - votes_status = [] - podcast_properties = \ - xml_podcast_to_dict(base_dir, rss_item, xml_str) - if podcast_properties: - podcast_properties['linkMimeType'] = link_mime_type - fediverse_handle = '' - extra_links = [] - _add_newswire_dict_entry(base_dir, - result, pub_date_str, - title, link, - votes_status, post_filename, - description, moderated, - mirrored, [], 32, session, debug, - podcast_properties, system_language, - fediverse_handle, extra_links) - post_ctr += 1 - if post_ctr >= max_posts_per_source: - break + if not pub_date_str: + continue + if not _valid_feed_date(pub_date_str): + continue + post_filename = '' + votes_status = [] + podcast_properties = \ + xml_podcast_to_dict(base_dir, rss_item, xml_str) + if podcast_properties: + podcast_properties['linkMimeType'] = link_mime_type + fediverse_handle = '' + extra_links = [] + _add_newswire_dict_entry(base_dir, + result, pub_date_str, + title, link, + votes_status, post_filename, + description, moderated, + mirrored, [], 32, session, debug, + podcast_properties, system_language, + fediverse_handle, extra_links) + post_ctr += 1 + if post_ctr >= max_posts_per_source: + break if post_ctr > 0: print('Added ' + str(post_ctr) + ' rss 2.0 feed items to newswire') return result