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): if not confirmation_question("Do you want to continue?", default_no=False):
print("Aborted.") print("Aborted.")
exit(0) 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(): def main():
# load nomie json file = sys.argv[1]
nomie_data = nomie.load_file(sys.argv[1]) data = nomie.get_data(file, True)
nomie.verify_continue(nomie_data) migrate(data["trackers"], data["events"])
trackers = nomie_data["trackers"]
events = nomie_data["events"]
migrate(trackers, events)
if __name__ == "__main__": if __name__ == "__main__":