Created
July 12, 2017 20:26
-
-
Save floreo/4c87f2be29fb39a2c4e8c773d44ae195 to your computer and use it in GitHub Desktop.
Bash script to import ICS into Radicale
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
#!/usr/bin/env bash | |
# This script import an ics calendar into Radicale | |
#TODO: check if the current calendar is up to date before to import it, I tried downloading it and comparing checksums but events ain't in the same order :( | |
declare -r _RADICALE_CALENDAR_URL="<URL of you Radicale calendar" | |
declare -r _ICS_CALENDAR_URL="<URL of your ICS calendar>" | |
declare -r _USERPASSWD="<user>:<password>" | |
_TEMPORARY_ICS="$(mktemp)" | |
curl -k --silent --output "${_TEMPORARY_ICS}" -X GET "${_ICS_CALENDAR_URL}" | |
if [ -s "${_TEMPORARY_ICS}" ] ; then | |
curl -k --silent --user "${_USERPASSWD}" -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @"${_TEMPORARY_ICS}" "${_RADICALE_CALENDAR_URL}" | |
rm "${_TEMPORARY_ICS}" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment