35 lines
669 B
Python
Executable file
35 lines
669 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
|
|
from habitmove.nomiedata import NomieImport
|
|
|
|
|
|
import sys
|
|
|
|
|
|
def migrate(data: NomieImport):
|
|
db = schema.migrate("output.db")
|
|
if not db:
|
|
raise ConnectionError
|
|
|
|
if data.trackers is not None:
|
|
|
|
habitlist = habits.migrate(db, data.trackers)
|
|
|
|
if data.events is not None:
|
|
rep.migrate(db, habitlist, data.events)
|
|
|
|
db.commit()
|
|
db.close()
|
|
|
|
|
|
def main():
|
|
file = sys.argv[1]
|
|
data = nomie.get_data(file)
|
|
migrate(data)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|