diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-10-01 20:00:14 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-10-01 20:00:14 +0200 |
commit | 1ff11e975cf2d5a07f4d1c4f5b9f84b8e74c6e4f (patch) | |
tree | c75842194bdc39b829b39d7bb11bdc44b72e6dea | |
parent | 55c17939fe956772edbeba836d806138d02b3d19 (diff) | |
download | ramaskrik-program-1ff11e975cf2d5a07f4d1c4f5b9f84b8e74c6e4f.tar.gz ramaskrik-program-1ff11e975cf2d5a07f4d1c4f5b9f84b8e74c6e4f.tar.bz2 ramaskrik-program-1ff11e975cf2d5a07f4d1c4f5b9f84b8e74c6e4f.zip |
Link to movie info page from event box.
-rw-r--r-- | ramaskrik-program.rb | 6 | ||||
-rw-r--r-- | room-schedule.rb | 3 |
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, |