Archive for April, 2008

CSV to iCal Update 2

April 10th, 2008 | Category: CSV to iCal,Golf,Google Calendar,Nerd,School,Stevens

Well, I can finally say, its done.  About as done as it is going to get.  I fixed the problems with the time zones, it is subscribable in Google Calendar, Thunderbird, and any other program that supports the iCalendar specification.  (Basically if it allows you to import ics files)  I wrote it with a cache function just in case the server gets hammered it wont be converting the csv to an ics file each time it is requested, only if the ics file is more then a certain age.  If it is under a certain age, it will simply serve up the old ics file.  This shouldn’t be a problem since the calendar doesn’t change that often, and when it does, it isn’t life or death that it updates right away.  Maybe I’ll code in a “force update” ability to it, but we’ll see.  My next project is to get a general csv to ical converter going for anybody out there.  Need to work on upload file security and dealing with differently formed csv files.  Not sure how I will do that, maybe have the user specify the column number of the required columns.  However I will run into the problem with how to create a UID that is constant so when an event changes it doesn’t just appear as a new event on the importing calendar but rather updates the old event.  I haven’t seen any csv files other then the crappy WebEvents format that Stevens uses, I will have to look around in case others include the added information for repeating events and such.  My next trick will be to automatically change the dates the program grabs from WebEvents, but I think that is for another day.  Right now, the converter is located at http://www.thegreatco.com/stevenscalendar/calendar.php Adding that link will get you the regular Student Life calendar (RSO Events mainly). Read more

No comments

CSV to iCal Update

April 07th, 2008 | Category: CSV to iCal,Google Calendar,Nerd,Stevens

So I wasted a bit more time on this today and decided to make a big change.  I decided to eliminate the whole file upload, file download and then import stuff.  I got the program to pull the calendar down automatically with some nice CURL work, then processed the calendar and output it automatically.  What does this mean?  It means you can put the url directly into something like Google Calendar and it autoupdates.  This eliminates the need for the UID as well since with each update comes a complete reload of all events on the calendar.  The problem I am running into now is time zone crap.  The time in the CSV is GMT, but I need to account for daylight savings time.  This might end up being another abandoned project to add to my list since I think it will require a complete rewrite of how times are handled.  Maybe I’ll pick this up another time…  I hope I do, otherwise its a shit load of wasted time.

No comments

Been really busy

April 07th, 2008 | Category: CSV to iCal,Google Calendar,Nerd,Stevens

I’ve been crazy busy for so long that I can’t keep up.  I average 5 to 6 hours of sleep a night.  But anyway.  I’ve been trying to keep track of events going on around school so I decided to give the Stevens event calendar a try.  Well, its terribly ugly and terribly user unfriendly.  Then I noticed the “Export Calendar” button and I rejoiced, but this was short lived.  Once I got the stupid thing to export and tried to import it into Google Calendar, I found out that Google Calendar couldn’t deal with the CSV.  So I set out to make this csv into an ics that Google could handle.

I started using excel since it handled csv files, you could easily address rows and columns and it supported good old VB.  So I did some work, cannibalized some old scripts I had and to my amazement, it shit out an ics file that Google could handle.  Or so I thought.  I quickly noticed events with blank Titles and empty descriptions.  A quick look at the ics file revealed errant quotes that Google was ignoring.  Having failed to figure out how to remove these quotes, I switched to php.

It has a function that easily reads a csv file into an array.  Looked like I should just be able to address each row and column in the array, just like in excel.  Huzzah!  After some work fixing times since 12:30 AM should read 00:30, I got what I thought was a working program.  I went to import this to GCal and I get an error.  Malformed ical file can’t be imported.  No worries, maybe I missed something.  Upon inspection of the ics file, it was indeed malformed.  But not by fault of my software.  The CSV given by this half assed event calendar had events with a start date, empty start time, empty end date, empty end time, and a ’0′ for the “All Day” event column.  Strange, if it doesn’t have a start time, end time, or end date it must be all day, but the all day column is blank…  What to do.  I simply set the program to ignore these lines, serve up the completed ics file and simply log the errors to a file for me to look at.  Sure enough about 8 events got ignored and went into that file.  What to do, say fuck it was what I came up with.  So I let the program ignore them and keep going on its happy little way exporting the ics.

Well upon fixing this error I come across my current problem.  “198 events processed, 101 events imported”.  I have a feeling it has something to do with the way I make the “UID:” line which is simply a hash of the title.  The only problem is there are probably multiple events with the same title.  I have no idea how to make a UID that is constant when anything but the name changes.  If the event time changes and there is no UID, Google will simply import that event and leave the old one.  This results in 2 events with 2 different times.  Which one is correct?  Maybe I will get the hash and do something else to it with another piece of information.  I guess the start date is unlikely to change, more the times.  Maybe I will use that appended to the end of the md5 hash.  Any suggestions to fix this would be great.  The converter is private for now, but that will be fixed as soon as I secure the uploader from those worthless scriptkiddies.

No comments

« Previous Page