fix: fix atom file not rebuilt if new files written
This commit is contained in:
parent
d097cb815d
commit
7ec6173c65
6 changed files with 6 additions and 50 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -138,3 +138,4 @@ dmypy.json
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
.chglog/
|
.chglog/
|
||||||
|
tests/data/
|
||||||
|
|
|
@ -36,12 +36,15 @@ def write_files(path: str, data: dict, max_num_entries: int) -> None:
|
||||||
index_file_write_header(path, data['title'])
|
index_file_write_header(path, data['title'])
|
||||||
urls = []
|
urls = []
|
||||||
art_output = {}
|
art_output = {}
|
||||||
|
new_file = False
|
||||||
for article in data['articles']:
|
for article in data['articles']:
|
||||||
art_output = write_article(article, data, path)
|
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)
|
index_file_write_footer(path)
|
||||||
# no need to update atom file if no new articles (write_article func returns url list)
|
# 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)
|
_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}"
|
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"
|
url = f"{data['gmi_url']}{data['title']}/{file_date}_{file_title}.gmi"
|
||||||
|
|
||||||
return {'new_file': new_file, 'url': url}
|
return {'new_file': new_file, 'url': url}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"feeds": {
|
|
||||||
"srad-science": {
|
|
||||||
"url": "https://srad.jp/science.rss",
|
|
||||||
"last_update": 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
|
|
|
@ -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
|
|
Loading…
Reference in a new issue