[Remind-Fans] From remind to Google calendar
Monty Zukowski
monty at codetransform.com
Tue Sep 18 12:26:18 EDT 2007
Yes, I did try yours. From what I read about iCalendar, it expects
the timezone to be defined in a VTIMEZONE declaration. Your tool
relies on the importing tool's predefined timezones.
Thanks for asking too, because it showed me an error in the script I
posted. Here's one that actually has the tiimezone info generated in
the ics file:
import vobject, datetime
import subprocess, string
import PyICU
pst = PyICU.ICUtzinfo.getInstance('US/Pacific')
class Event:
def __init__(self, date, time, duration, msg):
global pst
self.date=date
self.time=time
self.duration=duration
self.msg=msg
self.dtstart=datetime.datetime.strptime(date+" " +time,
"%Y/%m/%d %I:%M%p").replace(tzinfo=pst)
self.dtend = self.dtstart + datetime.timedelta(minutes=int(duration))
def events():
output = subprocess.Popen(["remind", "-s",
"/home/monty/.reminders"], stdout=subprocess.PIPE).communicate()[0]
events = []
for line in string.split(output, '\n'):
if string.strip(line):
print line
t=string.split(line)
date = t[0]
time = t[5]
duration = t[3]
msg = string.join(t[6:])
events.append(Event( date, time, duration, msg))
return events
cal = vobject.iCalendar()
cal.add('prodid').value='-//Remind2ical//codetransform.com//'
cal.add('version').value='2.0'
cal.add('method').value='PUBLISH'
events = events()
for e in events:
ev1 = cal.add('vevent')
ev1.add('dtstart').value = e.dtstart
ev1.add('dtend').value = e.dtend
ev1.add('dtstamp').value = datetime.datetime.now(pst)
ev1.add('summary').value = e.msg
f = open('monty.ics', 'w')
f.write( cal.serialize())
f.close()
Monty
On 17 Sep 2007 17:57:17 -0700, Mark Atwood <me at mark.atwood.name> wrote:
> "Monty Zukowski" <monty at codetransform.com> writes:
> > This script doesn't handle all day events. It doesn't create
> > recurring vevents either, just one event per line of output of remind
> > -s. It works for me though.
>
> Did you try mine?
>
> http://fallenpegasus.com/code/rem2ics/
>
> --
> Mark Atwood When you do things right, people won't be sure
> me at mark.atwood.name you've done anything at all.
> http://mark.atwood.name/ http://fallenpegasus.livejournal.com/
> _______________________________________________
> Remind-fans mailing list
> Remind-fans at lists.whatexit.org
> http://lists.whatexit.org/mailman/listinfo/remind-fans
>
More information about the Remind-fans
mailing list