from urllib.request import urlopen from json import load, dump from pathlib import Path from urllib.parse import urlparse from os.path import basename from sys import stderr manifest = load(urlopen("https://arcsidian.com/xivv/manifest.json")) get = [] for key in manifest.keys(): p = Path(f"share/Data/{key}") if p.exists(): s = sum(f.stat().st_size for f in p.glob('**/*') if f.is_file()) if s == manifest[key]: continue # print(f"{p} {s} != {manifest[key]}", file=stderr) url = f"https://xivvoices.com/npcs/{key}.zip" fn = f"{basename(key)}.{manifest[key]}.zip" print(f"{url} {fn}") # print(f"curl --limit-rate 3M -o 'tmp/{fn}' '{url}' && rm -rf 'share/Data/{key}' && unzip -d share/Data -P '{manifest[key]}#Arc' tmp/{fn} && rm 'tmp/{fn}'") with open("share/manifest.json", "w") as f: dump(manifest,f,indent=2)