test.lua

Mon, 26 Oct 2009 03:12:41 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 26 Oct 2009 03:12:41 +0000
changeset 0
11a0cbd6c216
child 2
19d109c1625f
permissions
-rw-r--r--

Initial commit

0
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 require "ical"
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 if arg[1] == "-v" then
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 require "serialization"
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 end
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 events = ical.load(io.open("XSF.ics" or arg[1]):read("*a"))
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 if arg[1] == "-v" then
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 print(serialization.serialize(events))
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 for i, event in ipairs(events) do
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 if event.type == "VEVENT" then
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 print(event.when and os.date("!%c", event.when) or "Unknown", event.SUMMARY);
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 end
11a0cbd6c216 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 end

mercurial