1
votes

This is my first post here at stackoverflow. My question is how to change the google calendar feed so that it only shows events for the current day automatically?

Basically what I want to do is output the feed onto a webpage that only shows events for today. The feed would change day by day. I've done something similar with other feeds (not google calendar) before except in those cases, I would be outputting the most recent "#" of posts. This wouldn't work if I were to show events for today only.

I've searched around on yahoo pipes and found a few where it filters the feed with a date that you have to input. This works except I want to be able to make it automatic instead of having someone input the date. Reading the google calendar feed api, there's also a date range I can do, but it's the same issue, I would have to specify the range by hand. Is there any way to automate that or some other alternative?

Is there some xslt magic I can do or something?

Thanks for the help!

3
Can you post the (stripped down) feed XML you try to work with? I my Google Calendar feed, there seems to be no notion of actual event dates. I only have <published> and <updated> dates.Tomalak
You're correct there. I only have the <published> and <updated> dates as well. The only notion of the actual event dates are actually in the content itself for each event entry where it says: Where: When: Event Status: etc.user186370
Which is a pretty lousy field to filter on, because it could be in any crazy kind of format. I guess you could try to retrieve the iCal, parse it a little, find out about DTSTART, DTEND and UID values for each VEVENT, and match that UID against the XML. If you want to pursue that, I could write some XSLT that would filter the XML against a list of "today" UIDs.Tomalak

3 Answers

2
votes

You could do this in Yahoo Pipes:

  1. Fetch the iCal feed from your Google calendar. (As others have commented, the Atom feeds that Google calendar provides do not seem to contain the event date in a reasonably structured format.)
  2. Filter the feed based on DTSTART/DTEND values. You can use the Date Builder module to get current date, just enter "today" as the date.

An example pipe (shows only events starting within the next 24 hours):

iCal next 24 h

0
votes

this is given by the sample of gdata

private static void dateRangeQuery(CalendarService service,
  DateTime startTime, DateTime endTime) throws ServiceException,
  IOException {
CalendarQuery myQuery = new CalendarQuery(eventFeedUrl);
myQuery.setMinimumStartTime(startTime);
myQuery.setMaximumStartTime(endTime);

// Send the request and receive the response:
CalendarEventFeed resultFeed = service.query(myQuery,
    CalendarEventFeed.class);

System.out.println("Events from " + startTime.toString() + " to "
    + endTime.toString() + ":");
System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
  CalendarEventEntry entry = resultFeed.getEntries().get(i);
  System.out.println("\t" + entry.getTitle().getPlainText());
}
System.out.println();

}

in which i think you can just set the minitime and maxtime to the same day?

0
votes

What you do is set the url parameters for the atom feed -- start-min to today and start-max to tomorrow -- also, note you'll need to be authenticated in order for this to work.