Skip to content

Instantly share code, notes, and snippets.

@pslobo pslobo/ Secret
Last active Aug 29, 2015

What would you like to do?
Send a list of tasks received from Launch Center Pro to Reminders using Fantastical 2
#coding: utf-8
import urllib2
import webbrowser
import sys
tasks = sys.argv[1] # The list of items received from LCP
url_str = '' # Initialize the x-callback-url
# Split the list by commas and iterate over each resulting item
for task in tasks.split(','):
'''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'''
if url_str == '':
url_str += 'fantastical2://x-callback-url/parse?sentence='+urllib2.quote(task,'')
url_str = 'fantastical2://x-callback-url/parse?sentence='+urllib2.quote(task,'')+'&x-success='+urllib2.quote(url_str,'')
# Check to see if Fantastical is installed and open the URL if it is.
if webbrowser.can_open("fantastical2://"):
print "Fantastical not installed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.