riesa-efau-kalender: add link, image
This commit is contained in:
parent
150f62c377
commit
18e40b3f3b
|
@ -16,7 +16,7 @@ def fmt_time t
|
||||||
end
|
end
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
attr_accessor :name, :location, :link
|
attr_accessor :name, :location, :link, :image
|
||||||
attr_reader :date
|
attr_reader :date
|
||||||
|
|
||||||
def date=(s)
|
def date=(s)
|
||||||
|
@ -35,14 +35,16 @@ end
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
|
|
||||||
doc = Nokogiri::HTML URI.open("https://riesa-efau.de/index.php?id=87")
|
url = "https://riesa-efau.de/index.php?id=87"
|
||||||
|
doc = Nokogiri::HTML URI.open(url)
|
||||||
doc.css(".tx-cal-controller .vevent").each do |vevent|
|
doc.css(".tx-cal-controller .vevent").each do |vevent|
|
||||||
ev = Event::new
|
ev = Event::new
|
||||||
ev.name = vevent.css("h3").text
|
ev.name = vevent.css("h3").text
|
||||||
ev.location = vevent.css(".location").text
|
ev.location = vevent.css(".location").text
|
||||||
.sub(/ *\.\.\.[^\.]*$/, "")
|
.sub(/ *\.\.\.[^\.]*$/, "")
|
||||||
ev.date = vevent.css(".datum").text
|
ev.date = vevent.css(".datum").text
|
||||||
ev.link = vevent.css(".url").attr('href').value
|
ev.link = URI.join url, vevent.css(".url").attr('href').value
|
||||||
|
ev.image = URI.join url, vevent.css(".images img").attr('src').value
|
||||||
events << ev
|
events << ev
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,6 +64,8 @@ ical = ERB::new <<~EOF
|
||||||
DTEND:<%= fmt_time(ev.date + 2 * 3600) %>
|
DTEND:<%= fmt_time(ev.date + 2 * 3600) %>
|
||||||
SUMMARY:<%= ev.name %>
|
SUMMARY:<%= ev.name %>
|
||||||
LOCATION:<%= ev.location %>
|
LOCATION:<%= ev.location %>
|
||||||
|
URL:<%= ev.link %>
|
||||||
|
ATTACH;FMTTYPE=image/jpeg:<%= ev.image %>
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
<% end %>
|
<% end %>
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
|
Loading…
Reference in New Issue