diff options
Diffstat (limited to 'mkconfig.py')
-rw-r--r-- | mkconfig.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mkconfig.py b/mkconfig.py new file mode 100644 index 0000000..47cc0ee --- /dev/null +++ b/mkconfig.py @@ -0,0 +1,25 @@ +import json +import os +import glob +import zipfile + +# handle settings +settings = {} +if os.path.isfile("settings.json"): + with open("settings.json", 'r') as f: + settings = json.load(f) + +# get all userscripts +paths = glob.glob(os.path.join('.', '**', '*.js'), recursive=True) +paths = [ path.removesuffix(".js") for path in paths ] + +# zipp +with zipfile.ZipFile("violentmonkey.zip", 'w', zipfile.ZIP_DEFLATED) as zipf: + for path in paths: + arcname = os.path.basename(path) + ".user.js" # basename and add .user.js suffix + path += ".js" + zipf.write(path, arcname=arcname) + zipf.writestr("violentmonkey", json.dumps({ + "scripts": { os.path.basename(path): {} for path in paths }, + "settings": settings, + })) |