lpil / icalendar

🗓️ A small library for reading and writing ICalendar files.
MIT License
103 stars 56 forks source link

Support multiple ICS entries in one file. #19

Open shymega opened 7 years ago

shymega commented 7 years ago

I'm using this library alongside with vdirsyncer and the single file storage backend.

I would like to get this library to parse a whole file with the entries in, but it does not seem to work.

This is the error I receive.

iex(1)> ICalendar.from_ics(File.read!("personal.ics"))
** (MatchError) no match of right hand side value: {:error, "Expected `T`, but found `Z` at line 1, column 9."}
    (icalendar) lib/icalendar/util/deserialize.ex:87: ICalendar.Util.Deserialize.parse_attr/2
    (elixir) lib/enum.ex:1811: Enum."-reduce/3-lists^foldl/2-0-"/3

I have not figured out the issue yet, but I would like to know if its possible to tweak icalendar to support multiple entries of a ICalendar in one file.

shymega commented 7 years ago

Hmm, it can read/write multiple events. Can't help but wonder if its vdirsyncer or khal..

lpil commented 7 years ago

Does it work with other icalendar libraries for other languages?

shymega commented 7 years ago

@lpil It works fine with Python's icalendar library, but ONLY if you pass the multiple=True option to the Calendar.from_ical() function. Looks like its to do with multiple VCALENDAR entries.

shymega commented 7 years ago

And the odd thing is, it should work fine. I don't know what the issue is. I haven't tried it in any other language, but I can do. Let me know.

ericdude4 commented 5 years ago

Your error seems like a datetime parsing problem. Does your .ics file have any DTSTART or DTEND values in the YYYYMMDD format?

It's fixed by the PR https://github.com/lpil/icalendar/pull/36