Parsing broken iCal-Feeds

25 views
Skip to first unread message

davidroetzel

unread,
Oct 18, 2010, 5:15:46 AM10/18/10
to RiCal
Hi,

first of all thank you so much for this wonderful library. It is great
for creating iCalendar data, has a wonderful implementation of
recurrence rules and works well for parsing (correct) iCal-Files.

However, I have a problem parsing random iCal-Feeds from the web. I
want to enable users to import events from as many sources as
possible, but ri_cal fails to parse most of the iCal-Data I found via
a quick google search.

The reason is always the same: A missing VTIMEZONE section. Here are
two examples:

http://www.dnalounge.com/calendar/dnalounge.ics
http://www.oscon.com/oscon2010/public/schedule/ical

(the second one suggests this might be a problem with all O'Reilly
conferences)

I understand that the data sources are at fault, but given that I
found quite a lot of examples of this problem, I wonder if there is a
way to have ri_cal parse this anyway.

Kind regards

David

Rick DeNatale

unread,
Oct 18, 2010, 7:54:25 AM10/18/10
to rica...@googlegroups.com
Well this is completely untested, but changing this (lines 19-21) in
lib/ri_cal/component/calendar.rb

def tz_info_source? #:nodoc:
@tz_source == 'TZINFO'
end

to
def tz_info_source? #:nodoc:
(@tz_source == 'TZINFO') || timezones.empty?
end

Looks like it might work for processing calendars which don't have
vtimezones but use timezone id's which TZInfo understands. These are
definitely outside of the icalendar specification, and there may be
issues if you try to turn around a produce an icalendar data stream
from such calendars, but you might want to try it.

> --
> You received this message because you are subscribed to the Google Groups "RiCal" group.
> To post to this group, send email to rica...@googlegroups.com.
> To unsubscribe from this group, send email to rical_gem+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rical_gem?hl=en.
>
>

--
Rick DeNatale

Help fund my talk at Ruby Conf 2010:http://pledgie.com/campaigns/13677
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

davidroetzel

unread,
Oct 18, 2010, 12:19:53 PM10/18/10
to RiCal
Hi,

On Oct 18, 1:54 pm, Rick DeNatale <rick.denat...@gmail.com> wrote:
> Well this is completely untested, but changing this (lines 19-21) in
> lib/ri_cal/component/calendar.rb
>
>       def tz_info_source? #:nodoc:
>         @tz_source == 'TZINFO'
>       end
>
> to
>       def tz_info_source? #:nodoc:
>         (@tz_source == 'TZINFO') || timezones.empty?
>       end
>
> Looks like it might work for processing calendars which don't have
> vtimezones but use timezone id's which TZInfo understands.  These are
> definitely outside of the icalendar specification, and there may be
> issues if you try to turn around a produce an icalendar data stream
> from such calendars, but you might want to try it.
>

thank you so much! This works very well for my use case.

Kind regards

David
Reply all
Reply to author
Forward
0 new messages