mirror of
https://github.com/rclone/rclone.git
synced 2024-11-24 09:24:05 +01:00
25 lines
589 B
Python
Executable File
25 lines
589 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
A demo metadata mapper
|
|
"""
|
|
|
|
import sys
|
|
import json
|
|
|
|
def main():
|
|
i = json.load(sys.stdin)
|
|
# Add tag to description
|
|
metadata = i["Metadata"]
|
|
if "description" in metadata:
|
|
metadata["description"] += " [migrated from domain1]"
|
|
else:
|
|
metadata["description"] = "[migrated from domain1]"
|
|
# Modify owner
|
|
if "owner" in metadata:
|
|
metadata["owner"] = metadata["owner"].replace("domain1.com", "domain2.com")
|
|
o = { "Metadata": metadata }
|
|
json.dump(o, sys.stdout, indent="\t")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|