Add Google Tasks to ICS converter
This commit is contained in:
parent
20232b17db
commit
bcc652275e
3 changed files with 35 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.ics
|
||||
Tasks.json
|
||||
.idea
|
31
main.py
Normal file
31
main.py
Normal file
|
@ -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()
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
ics
|
Loading…
Reference in a new issue