diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95ec9d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.ics +Tasks.json +.idea diff --git a/main.py b/main.py new file mode 100644 index 0000000..fe847c5 --- /dev/null +++ b/main.py @@ -0,0 +1,31 @@ +import json +from ics import Todo, Calendar, utils + +f = open('Tasks.json') +lists = json.load(f) + +for tasklist in lists["items"]: + cal = Calendar() + for task in tasklist["items"]: + todo = Todo() + todo.name = task["title"] + if "created" in task: + todo.created = utils.get_arrow(task["created"]) + else: + todo.created = utils.get_arrow(task["updated"]) # Not ideal but what can you do + if "notes" in task: + todo.description = task["notes"] + if "due" in task: + todo.due = task["due"] + if task["status"] == "needsAction": + todo.status = "NEEDS-ACTION" + elif task["status"] == "completed": + todo.status = "COMPLETED" + todo.completed = utils.get_arrow(task["completed"]) + todo.percent = 100 + cal.todos.add(todo) + of = open(tasklist["title"] + ".ics", 'w') + of.write(cal.serialize()) + of.close() + +f.close() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c12f7da --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +ics