39 lines
773 B
Python
39 lines
773 B
Python
|
#!/usr/bin/env python
|
||
|
import habitmove.schema as schema
|
||
|
import habitmove.habits as habits
|
||
|
import habitmove.repetitions as rep
|
||
|
import habitmove.nomie as nomie
|
||
|
|
||
|
|
||
|
import sys
|
||
|
|
||
|
|
||
|
def migrate(trackers, events):
|
||
|
db = schema.migrate("output.db")
|
||
|
if trackers is not None:
|
||
|
|
||
|
habitlist = habits.migrate(db, trackers)
|
||
|
|
||
|
if events is not None:
|
||
|
rep.migrate(db, habitlist, events)
|
||
|
|
||
|
db.commit()
|
||
|
db.close()
|
||
|
|
||
|
|
||
|
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)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|
||
|
|
||
|
# things to have as (data) classes:
|
||
|
# tracker, event, tag?
|
||
|
# habit, repetition
|