Updated: 2026-01-21
Update Note: ... using a spreadsheet is so much easier.
Key objective is the ability to easily manage the configuration of what needs to be pushed, get, and synched. The original approach used individual json files but that was a pain to manage.
The "final" approach is to manage the configuration in a spreadsheet.
When goosoft is run, a make config is called that then generates the required json files. Use pandas for that.
[
{
"File": "fast.json",
"Action": "push",
"Source": "onedrive",
"Include": 0,
"Account": "xxx",
"Cloud Directory": "xxx",
"Include Directories": 1,
"Local Source": "xxx",
"Local Target": null,
"Comment": null
},
{
"File": "fast.json",
"Action": "push",
"Source": "onedrive",
"Include": 0,
"Account": "xxx",
"Cloud Directory": "xxx",
"Include Directories": 1,
"Local Source": "xxx",
"Local Target": null,
"Comment": null
}, ...
]
import pandas as pd
import os
import json
def main():
script_path = os.path.abspath(__file__)
script_directory = os.path.dirname(script_path)
table = pd.read_excel(f"{script_directory}/goosoft_config/config.ods",engine='odf')
files = {}
for i,val in table.iterrows():
if not val['File'] in files:
files[val['File']] = []
files[val['File']].append(val.to_json())
for file in files:
with open(f"{script_directory}/goosoft_config/{file}","wt") as _f:
data = []
for i in files[file]:
temp = json.loads(i)
data.append(temp)
json.dump(data,_f,indent=4)
if __name__== "__main__":
main()
Note: This is a Google Site. Feedback here.