Been really busy
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