Skip to content

Instantly share code, notes, and snippets.

@ivan
Created December 2, 2015 10:41
Show Gist options
  • Save ivan/d2b665cd8edfcea32a07 to your computer and use it in GitHub Desktop.
Save ivan/d2b665cd8edfcea32a07 to your computer and use it in GitHub Desktop.
#!/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))
@ivan
Copy link
Author

ivan commented May 27, 2016

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