1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from January
2017</title>
5 <description>Entries from January
2017</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Introducing ical-archiver to split out old iCalendar entries
</title>
11 <link>http://people.skolelinux.org/pere/blog/Introducing_ical_archiver_to_split_out_old_iCalendar_entries.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Introducing_ical_archiver_to_split_out_old_iCalendar_entries.html
</guid>
13 <pubDate>Wed,
4 Jan
2017 12:
20:
00 +
0100</pubDate>
14 <description><p
>Do you have a large
<a href=
"https://icalendar.org/
">iCalendar
</a
>
15 file with lots of old entries, and would like to archive them to save
16 space and resources? At least those of us using KOrganizer know that
17 turning on and off an event set become slower and slower the more
18 entries are in the set. While working on migrating our calendars to a
19 <a href=
"http://radicale.org/
">Radicale CalDAV server
</a
> on our
20 <a href=
"https://freedomboxfoundation.org/
">Freedombox server
</a/
>, my
21 loved one wondered if I could find a way to split up the calendar file
22 she had in KOrganizer, and I set out to write a tool. I spent a few
23 days writing and polishing the system, and it is now ready for general
25 <a href=
"https://github.com/petterreinholdtsen/ical-archiver
">code for
26 ical-archiver
</a
> is publicly available from a git repository on
27 github. The system is written in Python and depend on
28 <a href=
"http://eventable.github.io/vobject/
">the vobject Python
29 module
</a
>.
</p
>
31 <p
>To use it, locate the iCalendar file you want to operate on and
32 give it as an argument to the ical-archiver script. This will
33 generate a set of new files, one file per component type per year for
34 all components expiring more than two years in the past. The vevent,
35 vtodo and vjournal entries are handled by the script. The remaining
36 entries are stored in a
'remaining
' file.
</p
>
38 <p
>This is what a test run can look like:
41 % ical-archiver t/
2004-
2016.ics
45 Writing t/
2004-
2016.ics-subset-vevent-
2004.ics
46 Writing t/
2004-
2016.ics-subset-vevent-
2005.ics
47 Writing t/
2004-
2016.ics-subset-vevent-
2006.ics
48 Writing t/
2004-
2016.ics-subset-vevent-
2007.ics
49 Writing t/
2004-
2016.ics-subset-vevent-
2008.ics
50 Writing t/
2004-
2016.ics-subset-vevent-
2009.ics
51 Writing t/
2004-
2016.ics-subset-vevent-
2010.ics
52 Writing t/
2004-
2016.ics-subset-vevent-
2011.ics
53 Writing t/
2004-
2016.ics-subset-vevent-
2012.ics
54 Writing t/
2004-
2016.ics-subset-vevent-
2013.ics
55 Writing t/
2004-
2016.ics-subset-vevent-
2014.ics
56 Writing t/
2004-
2016.ics-subset-vjournal-
2007.ics
57 Writing t/
2004-
2016.ics-subset-vjournal-
2011.ics
58 Writing t/
2004-
2016.ics-subset-vtodo-
2012.ics
59 Writing t/
2004-
2016.ics-remaining.ics
61 </pre
></p
>
63 <p
>As you can see, the original file is untouched and new files are
64 written with names derived from the original file. If you are happy
65 with their content, the *-remaining.ics file can replace the original
66 the the others can be archived or imported as historical calendar
67 collections.
</p
>
69 <p
>The script should probably be improved a bit. The error handling
70 when discovering broken entries is not good, and I am not sure yet if
71 it make sense to split different entry types into separate files or
72 not. The program is thus likely to change. If you find it
73 interesting, please get in touch. :)
</p
>
75 <p
>As usual, if you use Bitcoin and want to show your support of my
76 activities, please send Bitcoin donations to my address
77 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
&label=PetterReinholdtsenBlog
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>