Last active
November 12, 2022 22:58
-
-
Save mberneis/92a3125949e5e98c992c9f759eb1b062 to your computer and use it in GitHub Desktop.
Conversion of Todoist Tasks into AmbleNote Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Conversion of Todoist Tasks into AmbleNote Notes | |
// Step 1: Export into JSON file using https://darekkay.com/todoist-export | |
// Step 2: Use this code to convert to multiple markdown files. | |
// Step 3: Zip Markdown files | |
// Step 4: Import zip file into AmbleNote | |
if ($argc<2) { | |
die ("Please enter filename of todoist json file\n"); | |
} | |
$todos = json_decode(@file_get_contents($argv[1])); | |
if (is_null($todos)) { | |
die("Invalid file\n"); | |
} | |
// Good to go... | |
$projects=[]; | |
foreach ($todos->projects as $p) { | |
$note = "This note contains Tasks from Todoist Project: **{$p->name}**\n\n"; | |
$projects[$p->id] = ['filename' => $p->name.".md", 'note' => $note]; | |
} | |
foreach ($todos->items as $i) { | |
$projects[$i->project_id]['note'] .= "- [ ] ".$i->content."\n".$i->description."\n\n"; | |
} | |
foreach($projects as $p) { | |
print "Generating {$p['filename']}\n"; | |
file_put_contents($p['filename'],$p['note']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment