Created
June 15, 2011 09:39
-
-
Save tts/1026801 to your computer and use it in GitHub Desktop.
Building a VCALENDAR file
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
#!/bin/bash | |
# Yahoo!Pipesin tuottaman iCal-muotoisen tiedoston URL | |
url='http://pipes.yahoo.com/pipes/pipe.run?_id=6602675e62d5d95c7333285517e6a471&_render=ical&urlinput1=http%3A%2F%2Fspreadsheets.google.com%2Fpub%3Fkey%3Dtd1iey6KTeeTgGlE6U3_PPg%26output%3Dcsv' | |
# Haetaan data, ja tallennetaan se tiedostoksi | |
curl $url -o tolisten.ics | |
# Otetaan alussa olevat metatiedot talteen | |
grep X-WR tolisten.ics >XWR | |
# Yhdistetään alku, metatiedot ja aikavyöhyketiedot | |
cat alku XWR vtimezone >beforeevents | |
# Otetaan tapahtumatiedot erilleen | |
sed -n '/BEGIN:VEVENT/,$p' tolisten.ics >events | |
# Tyhjät rivit pois, ja korvataan DTSTART- ja DTEND-rivit | |
perl -pe 's/^\n//;s/DTSTART:/DTSTART;TZID=Europe\/Helsinki:/g;s/DTEND:/DTEND;TZID=Europe\/Helsinki:/g' events >tzidevents | |
# Yhdistetään alkuosa tapahtumatietoihin | |
cat beforeevents tzidevents >all.ics | |
# Siirretään valmis tiedosto webbipalvelimelle | |
mv all.ics ~/public_html/yle.ics | |
# Lopuksi vielä tiedoston lukuoikeudet kuntoon | |
chmod go+rx ~/public_html/yle.ics |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment