-
-
Save pslobo/ed089e2abc8c86d53023 to your computer and use it in GitHub Desktop.
Send a list of tasks received from Launch Center Pro to Reminders using GoodTask (formerly This Week)
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
#coding: utf-8 | |
import urllib2 | |
import webbrowser | |
import sys | |
events = sys.argv[1] # The list of items received from LCP | |
SEP = '/' # Change to any sperator you choose to use | |
url_str = '' # Initialize the x-callback-url | |
# Split the list by commas and iterate over each resulting item | |
for event in events.split(','): | |
# Split each item by the separator SEP | |
# and get tasks, dates and listname | |
try: | |
task = event.split(SEP)[0].strip() | |
except IndexError: | |
task = '' | |
try: | |
date = event.split(SEP)[1].strip() | |
except IndexError: | |
date = '' | |
try: | |
listname = event.split(SEP)[2].strip() | |
except IndexError: | |
listname = '' | |
# Create the task url | |
task_str = 'goodtask://add?text=%s&due=%s&list=%s' %(urllib2.quote(task,''), date, listname) | |
'''Check to see if there is already an item in the x-callback-url, | |
if not, create it, if there is then add task_str + &x-success followed by | |
a the URL-encoded url_str. This respects the needed encoding of nested | |
x-success entries.''' | |
if url_str == '': | |
url_str = task_str | |
else: | |
url_str = task_str+'&x-success='+urllib2.quote(url_str,'') | |
# Check to see if GoodTask is installed and open the URL if it is. | |
if webbrowser.can_open("goodtask://"): | |
webbrowser.open(url_str) | |
else: | |
print "GoodTask not installed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I made a less readable but more functional fork of this. I tested it only in the python console but it should work :).