remove obsolete bot script neinomat-termine
parent
ac75670c72
commit
203a86c887
@ -1,82 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
$:.unshift('vendor/ruby-mediawiki/lib')
|
||||
require 'mediawiki/dotfile'
|
||||
require 'date'
|
||||
require 'neinomat.lib.rb'
|
||||
|
||||
@wiki = MediaWiki.dotfile(nil,'entropia')
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def table_termine (t)
|
||||
body = '{| border=1 cellspacing="0" cellpadding="5" style="border-collapse:collapse;"'
|
||||
body += "\n"
|
||||
body += "| Datum \n| Uhrzeit \n| Ort \n| Beschreibung \n|-\n"
|
||||
t.each do |termin|
|
||||
body += "| " + termin["datum"].to_s + "\n"
|
||||
body += "| " + termin["uhrzeit"].to_s + "\n"
|
||||
body += "| " + termin["ort"].to_s + "\n"
|
||||
body += "| " + termin["beschreibung"].to_s + "\n"
|
||||
body += "|-\n"
|
||||
end
|
||||
body += "|}"
|
||||
return body
|
||||
end
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
termine = []
|
||||
|
||||
template = "Vorlage:Radio Chaotica-Sendung"
|
||||
@wiki.article(template).what_links_here.each do |page|
|
||||
if erste_sendung = parse_template(page, template)["erste_sendung"]
|
||||
|
||||
next if erste_sendung =~ /^\s*$/;
|
||||
|
||||
termin = {}
|
||||
termin["datum"] = erste_sendung.gsub(/\s*um\s*\d+:\d+$/,"")
|
||||
termin["uhrzeit"] = "16:00"
|
||||
termin["beschreibung"] = "[[" + page + "]]"
|
||||
termin["ort"] = "[http://www.querfunk.de Querfunk]"
|
||||
termine.push(termin)
|
||||
else
|
||||
$stderr.print(page, ": erste_sendung nicht gesetzt")
|
||||
end
|
||||
end
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
template = "Vorlage:Termin"
|
||||
@wiki.article(template).what_links_here.each do |page|
|
||||
termin = parse_template(page, template)
|
||||
termine.push(termin)
|
||||
end
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Get a real date
|
||||
termine.each do |termin|
|
||||
if termin["datum"] !~ /^[0-9]{2}\.[0-9]{2}\.[0-9]{4}.*$/
|
||||
puts "#{termin["datum"]} looks funny, fall back to today."
|
||||
termin["date"] = Date.today()
|
||||
else
|
||||
termin["date"] = Date.parse(datum2isodate(termin["datum"]))
|
||||
end
|
||||
end
|
||||
|
||||
termine = termine.sort do |x,y|
|
||||
x["date"] <=> y["date"]
|
||||
end
|
||||
|
||||
vergangene_termine = termine.clone.delete_if { |t| t["date"] >= Date.today() }
|
||||
kommende_termine = termine.clone.delete_if { |t| t["date"] < Date.today() }
|
||||
|
||||
body = "== Vergangene Termine ==\n"
|
||||
body += table_termine(vergangene_termine)
|
||||
|
||||
body += "\n== Kommende Termine ==\n"
|
||||
body += table_termine(kommende_termine)
|
||||
|
||||
a = @wiki.article("Benutzer:Neingeist/Termine")
|
||||
a.text = body
|
||||
a.submit("wiki ex machina")
|
Reference in New Issue