From d08fa4e375748f0f2232ea75645cb15126155047 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 10 Oct 2024 20:26:24 +0200 Subject: Updates for Ramaskrik 2024 - Don't hardcode year, use todays year instead. - Move output to separate build dir to make it a bit cleaner. - Misc fixes to set correct timezone in .ics file (still hardcoded, though...) --- ramaskrik-program.rb | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'ramaskrik-program.rb') diff --git a/ramaskrik-program.rb b/ramaskrik-program.rb index 5dfe5d5..87ba2ba 100755 --- a/ramaskrik-program.rb +++ b/ramaskrik-program.rb @@ -26,33 +26,8 @@ require 'json' require 'scrapers/ramaskrik' require 'nokogiri' require 'open-uri' -#require 'room-schedule' require 'uri' -def generate_graphs(events) - days = events.group_by { |event| event.start_time.strftime("%A %d.%m.%Y") } - days.map do |day, events| - rooms = events.group_by { |e| e.venue } - - graph = SVG::Graph::RoomSchedule.new({ - graph_title: day, - show_graph_title: true, - show_x_guidelines: true, - width: 1280, - height: rooms.keys.length * 100 + 25, - key: false, - x_label_format: "%H:%M", - timescale_divisions: "30 minutes", - }) - - rooms.each do |title, data| - graph.add_data(title: title, data: data) - end - - yield graph - end -end - class EventDecorator < SimpleDelegator attr_reader :offset attr_reader :height @@ -107,12 +82,16 @@ def make_sorted_event_lists_by_date(events_by_date) new_list end -title = "Ramaskrik 2023 - Program" +year = Date::today.year + +title = "Ramaskrik #{year} - Program" eventlist = make_sorted_event_lists_by_date(import_events_from_json(IO.read(ARGV[0]))) +Dir::mkdir('build') unless Dir::exist?('build') + t_html = ERB.new(IO.read("index.html.erb"), trim_mode: '>') -IO.write("index.html", t_html.result(binding)) +IO.write("build/index.html", t_html.result(binding)) t_ics = ERB.new(IO.read("program.ics.erb"), trim_mode: '<>') -IO.write("program.ics", t_ics.result(binding).gsub(/\n/, "\r\n")) +IO.write("build/program-ramaskrik-#{year}.ics", t_ics.result(binding).gsub(/\n/, "\r\n")) -- cgit v1.2.3