Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2015 10:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ivan/d2b665cd8edfcea32a07 to your computer and use it in GitHub Desktop.
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