Refactor nomie data ingestion

This commit is contained in:
Marty Oehme 2021-12-02 18:54:56 +01:00
parent 0e31975cb0
commit c5b532b618
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
2 changed files with 11 additions and 6 deletions

View File

@ -33,3 +33,11 @@ def verify_continue(data):
if not confirmation_question("Do you want to continue?", default_no=False):
print("Aborted.")
exit(0)
# return the data belonging to nomie
def get_data(file, interactive):
nomie_data = load_file(file)
if interactive:
verify_continue(nomie_data)
return nomie_data

9
run.py
View File

@ -22,12 +22,9 @@ def migrate(trackers, events):
def main():
# load nomie json
nomie_data = nomie.load_file(sys.argv[1])
nomie.verify_continue(nomie_data)
trackers = nomie_data["trackers"]
events = nomie_data["events"]
migrate(trackers, events)
file = sys.argv[1]
data = nomie.get_data(file, True)
migrate(data["trackers"], data["events"])
if __name__ == "__main__":