1234567891011121314151617181920212223242526 |
- #!/usr/bin/python3
- import os
- import sys
- import yaml
- def migrate(values):
- if not values["storage"]["enable_incomplete_dir"]:
- return values
- if not values["storage"]["mount_incomplete_as_separate_storage"]:
- return values
- values["storage"]["incomplete_dir_path"] = values["storage"]["downloads_incomplete"]["mount_path"]
- values["storage"]["downloads_incomplete"].pop("mount_path")
- return values
- if __name__ == "__main__":
- if len(sys.argv) != 2:
- exit(1)
- if os.path.exists(sys.argv[1]):
- with open(sys.argv[1], "r") as f:
- print(yaml.dump(migrate(yaml.safe_load(f.read()))))
|