Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/python
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))
Owner

ivan commented May 27, 2016

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