Created
September 1, 2021 14:15
-
-
Save christoph-frick/dce128ccd6112dc6eac215f66eebdb7a to your computer and use it in GitHub Desktop.
Convert ICS to PAL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@Grab('org.slf4j:slf4j-simple:1.7.32'), | |
@Grab('org.mnode.ical4j:ical4j:3.1.0'), | |
]) | |
import net.fortuna.ical4j.data.CalendarBuilder | |
import net.fortuna.ical4j.model.Component | |
import net.fortuna.ical4j.model.Property | |
import net.fortuna.ical4j.model.component.CalendarComponent | |
import net.fortuna.ical4j.model.property.DateProperty | |
// disable the need for jcache | |
System.setProperty("net.fortuna.ical4j.timezone.cache.impl", "net.fortuna.ical4j.util.MapTimeZoneCache") | |
// shut up logging | |
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "warn") | |
assert args.length>0 | |
def fileName = args[0] | |
assert (fileName as File).exists() | |
println "XX ${args[0]}" | |
new CalendarBuilder().build(new FileInputStream(fileName)).getComponents(Component.VEVENT).each{ | |
def dtstart = it.getProperty(Property.DTSTART).date | |
def summary = it.getProperty(Property.SUMMARY).value | |
println "${dtstart.format('yyyyMMdd')}\t${summary}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment