A fork of andytuba RES settings backup script
Originally [andytuba]{https://gist.github.com/andytuba) created a script to convert Chrome RES backups and concert them to FireFox RES backups. I needed to go the other direction so I started this.
A fork of andytuba RES settings backup script
Originally [andytuba]{https://gist.github.com/andytuba) created a script to convert Chrome RES backups and concert them to FireFox RES backups. I needed to go the other direction so I started this.
| #!/usr/bin/python | |
| import json | |
| import codecs | |
| import sqlite3 | |
| con = sqlite3.connect('res.db') | |
| cur = con.cursor() | |
| db = cur.execute('SELECT key, CAST(value as TEXT) FROM ItemTable').fetchall() | |
| with codecs.open('store.json', 'w', 'utf-8') as f: | |
| dump = json.dumps(dict(db)) | |
| f.write(dump) |
| #!/usr/bin/python | |
| import json | |
| import codecs | |
| import sqlite3 | |
| con = sqlite3.connect('res.db') | |
| cur = con.cursor() | |
| cur.execute('CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)') | |
| with codecs.open('store.json', 'rU', 'utf-8') as data_file: | |
| data = json.load(data_file) | |
| for (key, value) in data.items(): | |
| cur.execute('INSERT INTO ItemTable values (?,?)', (key, value)) | |
| con.commit() |