--- /dev/null
+Title: Introducing ical-archiver to split out old iCalendar entries
+Tags: english
+Date: 2017-01-04 12:20
+
+<p>Do you have a large <a href="https://icalendar.org/">iCalendar</a>
+file with lots of old entries, and would like to archive them to save
+space and resources? At least those of us using KOrganizer know that
+turning on and off an event set become slower and slower the more
+entries are in the set. While working on migrating our calendars to a
+<a href="http://radicale.org/">Radicale CalDAV server</a> on our
+<a href="https://freedomboxfoundation.org/">Freedombox server</a/>, my
+loved one wondered if I could find a way to split up the calendar file
+she had in KOrganizer, and I set out to write a tool. I spent a few
+days writing and polishing the system, and it is now ready for general
+consumption. The
+<a href="https://github.com/petterreinholdtsen/ical-archiver">code for
+ical-archiver</a> is publicly available from a git repository on
+github. The system is written in Python and depend on the vobject
+Python module.</p>
+
+<p>To use it, locate the iCalendar file you want to operate on and
+give it as an argument to the ical-archiver script. This will
+generate a set of new files, one file per component type per year for
+all components expiring more than two years in the past. The vevent,
+vtodo and vjournal entries are handled by the script. The remaining
+entries are stored in a 'remaining' file.</p>
+
+<p>This is what a test run can look like:
+
+<p><pre>
+% ical-archiver t/2004-2016.ics
+Found 3612 vevents
+Found 6 vtodos
+Found 2 vjournals
+Writing t/2004-2016.ics-subset-vevent-2004.ics
+Writing t/2004-2016.ics-subset-vevent-2005.ics
+Writing t/2004-2016.ics-subset-vevent-2006.ics
+Writing t/2004-2016.ics-subset-vevent-2007.ics
+Writing t/2004-2016.ics-subset-vevent-2008.ics
+Writing t/2004-2016.ics-subset-vevent-2009.ics
+Writing t/2004-2016.ics-subset-vevent-2010.ics
+Writing t/2004-2016.ics-subset-vevent-2011.ics
+Writing t/2004-2016.ics-subset-vevent-2012.ics
+Writing t/2004-2016.ics-subset-vevent-2013.ics
+Writing t/2004-2016.ics-subset-vevent-2014.ics
+Writing t/2004-2016.ics-subset-vjournal-2007.ics
+Writing t/2004-2016.ics-subset-vjournal-2011.ics
+Writing t/2004-2016.ics-subset-vtodo-2012.ics
+Writing t/2004-2016.ics-remaining.ics
+%
+</pre></p>
+
+<p>As you can see, the original file is untouched and new files are
+written with names derived from the original file. If you are happy
+with their content, the *-remaining.ics file can replace the original
+the the others can be archived or imported as historical calendar
+collections.</p>
+
+<p>The script should probably be improved a bit. The error handling
+when discovering broken entries is not good, and I am not sure yet if
+it make sense to split different entry types into separate files or
+not. The program is thus likely to change. If you find it
+interesting, please get in touch. :)</p>
+
+<p>As usual, if you use Bitcoin and want to show your support of my
+activities, please send Bitcoin donations to my address
+<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&label=PetterReinholdtsenBlog">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>