From fc32361fe53d674fda36d2ccd88da04dbfe7f64f Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 8 Oct 2005 05:26:04 +0000 Subject: [PATCH] termine aus upcoming.org auf ka.stadtwiki.net --- stadtwiki-upcoming | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 stadtwiki-upcoming diff --git a/stadtwiki-upcoming b/stadtwiki-upcoming new file mode 100755 index 0000000..4cdbe68 --- /dev/null +++ b/stadtwiki-upcoming @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby + +require 'http-access2' +require 'mediawikibot' +require 'vpim/icalendar' +include Vpim + +if ARGV.size() != 2 + $stderr.print($0 + " \n") + exit(1) +end + +$ical_url = "http://upcoming.org/calendar/metro/1551" + +def get_events() + @client = HTTPAccess2::Client.new() + ical = @client.get_content($ical_url) + events = [] + Icalendar.decode(ical).each do |publish| + publish.events.each do |event| + events.push(event) + end + end + return events +end + +body = "Folgende Termine stammen von http://upcoming.org:\n\n" +get_events().each do |event| + body += "* #{event.dtstart.mday}.#{event.dtstart.month}. #{event.summary}\n" +end + +b = MediaWikiBot::WikiBot.new("http://ka.stadtwiki.net/") +b.login(ARGV[0], ARGV[1]) + +b.edit("Benutzer:Neingeist/Termine_aus_upcoming.org", body, "Import")