colander - filtering your calendar
420
Colander filters calender in ICS files. It can either be used as standalone application via command line interface or within JVM applications using the API.
Usage: colander [options] <input.ics> [<output.ics]>
Options:
--help
(optional) Show this message
Default: false
--remove-description
Remove calender component when description contains expression
Default: []
--remove-duplicate-events
Remove event when summary, description, start date or end date are the
same in another event
Default: false
--remove-empty-events
Remove events when summary and description are empty
Default: false
--remove-summary
Remove calender component when summary contains expression
Default: []
--replace-description
Replace in description of calender components (regex)
Syntax: --replace-descriptionkey=value
Default: {}
--replace-summary
Replace in summary calender components (regex)
Syntax: --replace-summarykey=value
Default: {}
colander --remove-summary "Remove, RemoveIncludingLeadingSpace" --remove-summary "Another One to remove" --replace-summary "l.ne=line" cal.ics cal-new.ics
output.ics file is passed, colander creates one, basing on the file name and the current timestamp, e.g. input-20170129194742.ics.output.ics exists, colander fails.logs folder.The basic logic of colander is wrapped in the core module. This can be reused in other applications. For now, this is not hosted on maven central, but on your can get it via jitpack.
Add the following maven repository to your POM.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Then add the actual dependency
<dependency>
<groupId>com.github.schnatterer.colander</groupId>
<artifactId>colander-core</artifactId>
<version>0.1.0</version>
</dependency>
Colander.toss("/some/input.ics")
.removeDuplicateEvents()
.removeEmptyEvents()
.removePropertyContains(Property.SUMMARY, "Remove me")
.removeDescriptionContains("Remove me 2")
// Generic replace in property
.replaceInProperty(Property.DESCRIPTION, "L.ne", "Line")
// Convenience: replace in property summary
.replaceInSummary("Replace", "Replace!")
.filter(event -> {
System.out.println(event.toString());
return Optional.of(event);
})
.rinse()
.toFile("/some/output.ics");
Under the hood, colander uses ical4j. You can get an instance of the result like so
Calendar cal = Colander.toss("/some/input.ics")
// ...
.rinse()
.toCalendar("/some/output.ics");
More examples can be found in the
Content type
Image
Digest
Size
71.5 MB
Last updated
about 5 years ago
docker pull schnatterer/colander