aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ramaskrik-program.rb6
-rw-r--r--room-schedule.rb3
2 files changed, 7 insertions, 2 deletions
diff --git a/ramaskrik-program.rb b/ramaskrik-program.rb
index a9af3a0..c485fce 100644
--- a/ramaskrik-program.rb
+++ b/ramaskrik-program.rb
@@ -18,12 +18,14 @@ require 'date'
require 'nokogiri'
require 'open-uri'
require 'room-schedule'
+require 'uri'
class Movie
- attr_reader :title, :start_time, :end_time, :venue
+ attr_reader :title, :link, :start_time, :end_time, :venue
def initialize(node)
@title = node.css("h4").text.strip
+ @link = URI.join("https://ramaskrik.no", node.css("h4 a").attribute('href').value)
@start_time = DateTime.parse(node.css(".date").attribute('title').value)
@end_time = DateTime.parse(@start_time.strftime('%F') + node.css(".prgtype-endTime").text.strip.sub(/\w+/, ''))
@end_time += 1 if @end_time < @start_time
@@ -35,7 +37,7 @@ class Movie
end
end
-doc = Nokogiri::HTML(open("program.html")) ## open("https://ramaskrik.no/program/"))
+doc = Nokogiri::HTML(open("https://ramaskrik.no/program/"))
movies = doc.css(".kultur-type-movie").map { |movie| Movie.new(movie) }
days = movies.group_by { |movie| movie.start_time.strftime("%A %d.%m.%Y") }
days.each do |d, movies|
diff --git a/room-schedule.rb b/room-schedule.rb
index bb6e677..fd4e282 100644
--- a/room-schedule.rb
+++ b/room-schedule.rb
@@ -94,6 +94,9 @@ module SVG
p = body.add_element("p", {
"class" => "event-title",
})
+ if entry.link
+ p = p.add_element("a", { "href" => entry.link })
+ end
p.add_text(entry.title)
t = switch.add_element("text", {
"x" => (bar_start + @font_size / 2).to_s,