Marty Oehme
bea6c0eca5
Program can now be invoked through poetry for development purposes, invoke as follows from main directory: `poetry run move`. Alternatively, can still be invoked via `python run.py <nomie-json>` and now via `./run.py <nomie-json>` which uses system default python installation. For now both commands are only mainly useful from the poetry development virtual environment itself.
38 lines
773 B
Python
Executable file
38 lines
773 B
Python
Executable file
#!/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
|