From f2b9e87f01799ef8d52b44e2ee228c6186ce9556 Mon Sep 17 00:00:00 2001 From: relikd Date: Mon, 7 Sep 2020 00:43:36 +0200 Subject: [PATCH] New main command, rebuild index --- src/main.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main.py b/src/main.py index baa73c8..68e6171 100755 --- a/src/main.py +++ b/src/main.py @@ -17,12 +17,19 @@ def print_usage_and_exit(): import | check '_in' folder for new apps tracker | update tracking domains icons | check & download missing icons + index | rebuild index & root html run [bundle_id] [...] | recombine and rebuild apps del [bundle_id] [...] | remove app and rebuild index ''') exit(0) +def rebuild_index(inclRoot=False): + html_index.process() + if inclRoot: # TODO: remove check if root contains dynamic content + html_root.process() + + def del_id(bundle_ids): print('removing apps from website:') if bundle_ids == ['*']: @@ -37,7 +44,7 @@ def del_id(bundle_ids): update_index = True print('') if update_index: - html_index.process() + rebuild_index() def combine_and_update(bundle_ids, where=None): @@ -50,8 +57,7 @@ def combine_and_update(bundle_ids, where=None): print('no new bundle, not rebuilding index') return bundle_download.process(new_ids) - html_index.process() - html_root.process() + rebuild_index() def import_update(): @@ -87,19 +93,21 @@ try: params = args[1:] if cmd == 'import': import_update() - elif cmd == 'del': - if len(params) == 0: - print_usage_and_exit() - del_id(params) # ['_manually'] + elif cmd == 'tracker': + tracker_update() + # tracker_download.combine_all('x') + elif cmd == 'icons': + if bundle_download.download_missing_icons(force=False): + rebuild_index() + elif cmd == 'index': + rebuild_index(inclRoot=True) elif cmd == 'run': if len(params) == 0: print_usage_and_exit() combine_and_update(params) # ['*'], where=['test.com'] - elif cmd == 'icons': - if bundle_download.download_missing_icons(force=False): - html_index.process() - elif cmd == 'tracker': - tracker_update() - # tracker_download.combine_all('x') + elif cmd == 'del': + if len(params) == 0: + print_usage_and_exit() + del_id(params) # ['_manually'] except Exception as e: mylib.err('critical', e)