added option to skip fetching remote profile data

This commit is contained in:
likhy 2023-09-28 20:06:52 -07:00
parent 0eb134136f
commit 57bd52e537

View File

@ -273,15 +273,19 @@ if __name__ == "__main__":
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
p.add_argument("template", help="an html template file") p.add_argument("template", help="an html template file")
p.add_argument("content", help="text file for microblog content") p.add_argument("content", help="text file for microblog content")
p.add_argument("--sort", \ p.add_argument("--sort", \
help="sorts content from oldest to newest" help="sorts content from oldest to newest"
" (this is a separate operation from page generation)", \ " (this is a separate operation from page generation)", \
action="store_true") action="store_true")
p.add_argument("--skip-fetch", \
help="skips fetching profile data from remote sources;"
" has no effect if webring is not enabled",\
action="store_true")
args = p.parse_args() args = p.parse_args()
if args.sort: if args.sort:
sort(args.content) sort(args.content)
exit() exit()
return args.template, args.content return args.template, args.content, args.skip_fetch
# assume relative path # assume relative path
def demote_css(template, css_list, level=1): def demote_css(template, css_list, level=1):
@ -476,7 +480,7 @@ if __name__ == "__main__":
return render(list_of_json_objs, f_cfg["format"]) return render(list_of_json_objs, f_cfg["format"])
def main(): def main():
tpl, content = get_args() tpl, content, skip_fetch = get_args()
cfg = load_settings() cfg = load_settings()
if cfg == None: if cfg == None:
print("exit: no settings.toml found.", file=sys.stderr) print("exit: no settings.toml found.", file=sys.stderr)
@ -511,6 +515,7 @@ if __name__ == "__main__":
if cfg["webring"]["enabled"] == True: if cfg["webring"]["enabled"] == True:
export_profile( export_profile(
len(p), p[0].get_epoch_time(), cfg["webring"] ) len(p), p[0].get_epoch_time(), cfg["webring"] )
if not skip_fetch:
fellows = fn1(cfg["webring"]["following"] ) fellows = fn1(cfg["webring"]["following"] )
if fellows != []: if fellows != []:
updated += writepage( updated += writepage(