diff options
author | felinae98 | 2020-12-11 21:44:37 +0800 |
---|---|---|
committer | felinae98 | 2020-12-11 21:44:37 +0800 |
commit | 8a70a4c9c971a3e5c92ece961541d98265c9e94f (patch) | |
tree | 642879b8168f6d65ebcbc514e5a4883ace0db4ec /clashup | |
parent | 6139c27687bab39ac07684741cafdf7b68e939a6 (diff) | |
download | aur-clashup.tar.gz |
add period update
Diffstat (limited to 'clashup')
-rwxr-xr-x | clashup | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -27,7 +27,8 @@ class ClashUp: "is_subscribe_banned": false, "custom_rules": [], "mmdb_file_url": "http://www.ideame.top/mmdb/Country.mmdb", - "mmdb_version_url: "http://www.ideame.top/mmdb/version" + "mmdb_version_url: "http://www.ideame.top/mmdb/version", + "periodically_update": false } ''' def __init__(self): @@ -139,9 +140,13 @@ class ClashUp: parser = argparse.ArgumentParser() parser.add_argument('--pre', action='store_true') parser.add_argument('--post', action='store_true') + parser.add_argument('--update', action='store_true') args = parser.parse_args() self.load_conf() - if args.pre: + if args.update: + self.update(False) + self.update_mmdb() + elif args.pre and not self.config.get('periodically_update', False): if self.config['is_subscribe_banned']: logging.info('Subscribe is banned, pass this run') else: @@ -149,7 +154,7 @@ class ClashUp: if self.config.get('mmdb_version_url') and self.config.get('mmdb_file_url'): with daemon.DaemonContext(): self.update_mmdb() - elif args.post: + elif args.post and not self.config.get('periodically_update', False): if self.config['is_subscribe_banned']: if self.update_time_cache(): self.update(True) |