diff --git a/.gitignore b/.gitignore index add6f9b..ff3e6fc 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,4 @@ dmypy.json cython_debug/ .chglog/ +tests/data/ diff --git a/tenkan/files.py b/tenkan/files.py index 2d916f5..1f43e3b 100644 --- a/tenkan/files.py +++ b/tenkan/files.py @@ -36,12 +36,15 @@ def write_files(path: str, data: dict, max_num_entries: int) -> None: index_file_write_header(path, data['title']) urls = [] art_output = {} + new_file = False for article in data['articles']: art_output = write_article(article, data, path) - urls.append(art_output['url']) + if art_output.get('new_file'): + urls.append(art_output['url']) + new_file = True index_file_write_footer(path) # no need to update atom file if no new articles (write_article func returns url list) - if art_output.get('new_file'): + if new_file: _rebuild_atom_file(path=path, data=data, urls=urls) @@ -106,7 +109,6 @@ def write_article( f"# {article['article_title']}\n\n=> {article['http_url']}\n\n{date}, {author}\n\n{content}" ) url = f"{data['gmi_url']}{data['title']}/{file_date}_{file_title}.gmi" - return {'new_file': new_file, 'url': url} diff --git a/tests/data/feeds.json b/tests/data/feeds.json deleted file mode 100644 index 79f107a..0000000 --- a/tests/data/feeds.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "last_run": "2022-01-12 23:22:29.686539", - "feeds": { - "srad-science": { - "url": "https://srad.jp/science.rss", - "last_update": null, - "hash_last_update": "" - } - } -} diff --git a/tests/data/feeds.json_fail b/tests/data/feeds.json_fail deleted file mode 100644 index 4e1b2bb..0000000 --- a/tests/data/feeds.json_fail +++ /dev/null @@ -1,7 +0,0 @@ -{ - "feeds": { - "srad-science": { - "url": "https://srad.jp/science.rss", - "last_update": null - } - } diff --git a/tests/data/tenkan.conf b/tests/data/tenkan.conf deleted file mode 100644 index 4e30c2b..0000000 --- a/tests/data/tenkan.conf +++ /dev/null @@ -1,15 +0,0 @@ -[tenkan] -gemini_path = /tmp/ -gemini_url = gemini://space.fqserv.eu/feeds/ - -[filters] -# authors we don't want to read -authors_blacklist = Rabaudy, Élise Costa, Sagalovitch, Pessin, Gallerey -titles_blacklist = Pinned -links_blacklist = slate.fr/audio, slate.fr/grand-format, slate.fr/boire-manger/top-chef - -[formatting] -title_size = 120 -# feeds with a truncated content -# will be fetched and converted using readability-lxml -truncated_feeds = gurumed, slate, cnrs diff --git a/tests/data/tenkan.conf_fail b/tests/data/tenkan.conf_fail deleted file mode 100644 index efb0cfc..0000000 --- a/tests/data/tenkan.conf_fail +++ /dev/null @@ -1,15 +0,0 @@ -#[tenkan] -#gemini_path = /tmp/hu/ -#gemini_url = gemini://space.fqserv.eu/feeds/ - -[filters] -# authors we don't want to read -authors_blacklist = Rabaudy, Élise Costa, Sagalovitch, Pessin, Gallerey -titles_blacklist = Pinned -links_blacklist = slate.fr/audio, slate.fr/grand-format, slate.fr/boire-manger/top-chef - -[formatting] -title_size = 120 -# feeds with a truncated content -# will be fetched and converted using readability-lxml -truncated_feeds = gurumed, slate, cnrs