diff options
Diffstat (limited to 'ramaskrik-program.rb')
-rwxr-xr-x | ramaskrik-program.rb | 35 |
1 files changed, 7 insertions, 28 deletions
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")) |