You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/www-plugins/chrome-ublock/files/configure.py

22 lines
472 B

#!/usr/bin/python3
import plyvel
import json
import sys
from os import path
data = json.load(sys.stdin)
if len(sys.argv) < 3:
sys.stderr.write("configure.py chrome-dir ext-id")
sys.exit(1)
chrome_dir = sys.argv[1]
ext_id = sys.argv[2]
db_path = path.join(chrome_dir,"Default/Local Extension Settings", ext_id)
db = plyvel.DB(db_path, create_if_missing=True)
for k,v in data.items():
db.put(bytes(k,encoding='utf-8'), bytes(v,encoding='utf-8'))
db.close()