From: Moritz Warning Date: Mon, 28 Sep 2020 09:23:41 +0000 (+0200) Subject: misc/collect.py: cleanup www_path variable X-Git-Tag: v3.0.3~1 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=57d3cdb10fe0bf34c47f98d72391495e02cbc615;p=web%2Ffirmware-selector-openwrt-org.git misc/collect.py: cleanup www_path variable --- diff --git a/misc/collect.py b/misc/collect.py index ad27413..0b2968d 100755 --- a/misc/collect.py +++ b/misc/collect.py @@ -118,7 +118,8 @@ def merge_profiles(profiles, download_url): return output -def update_config(config_path, versions): +def update_config(www_path, versions): + config_path = "{}/config.js".format(www_path) content = "" with open(str(config_path), "r", encoding="utf-8") as file: content = file.read() @@ -137,9 +138,7 @@ Update config.json. def scrape(args): url = args.domain - www_path = args.www_path - config_path = "{}/config.js".format(www_path) - data_path = "{}/data".format(www_path) + data_path = "{}/data".format(args.www_path) versions = {} def handle_release(target): @@ -186,7 +185,7 @@ def scrape(args): versions[release] = "data/{}/overview.json".format(release) - update_config(config_path, versions) + update_config(args.www_path, versions) """ @@ -198,9 +197,7 @@ Update config.json. def scrape_wget(args): url = args.domain - www_path = args.www_path - config_path = "{}/config.js".format(www_path) - data_path = "{}/data".format(www_path) + data_path = "{}/data".format(args.www_path) versions = {} with tempfile.TemporaryDirectory() as tmp_dir: @@ -253,7 +250,7 @@ def scrape_wget(args): else: json.dump(output, outfile, sort_keys=True) - update_config(config_path, versions) + update_config(args.www_path, versions) """ @@ -305,8 +302,6 @@ Update config.json. def scan(args): - # firmware selector config - config_path = "{}/config.js".format(args.www_path) # the overview.json files are placed here data_path = "{}/data".format(args.www_path) versions = {} @@ -365,7 +360,7 @@ def scan(args): else: json.dump(output, outfile, sort_keys=True) - update_config(config_path, versions) + update_config(args.www_path, versions) def main():