Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2015 10:41
What would you like to do?
import sys
import json
obj = json.load(sys.stdin)
def fix_save_path(p):
p = p.replace('\\', '/')
if p[1:3] == ':/':
p = '/mnt/' + p[0] + '/' + p[3:]
if not p.endswith('/'):
p += '/'
return p
obj["qBt-savePath"] = fix_save_path(obj["qBt-savePath"])
obj["save_path"] = fix_save_path(obj["save_path"])
if "mapped_files" in obj:
for n, p in enumerate(obj["mapped_files"]):
obj["mapped_files"][n] = p.replace('\\', '/')
sys.stdout.write(json.dumps(obj, indent=2))
Copy link

ivan commented May 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment