diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-10-10 20:26:24 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-10-10 20:26:24 +0200 |
commit | d08fa4e375748f0f2232ea75645cb15126155047 (patch) | |
tree | a157b2419601c8abc77ac1b72405a5aab3fcb779 /ramaskrik-program.rb | |
parent | 51ef51bbe3b741a76d1d44b8ce8c1d8a07427e1f (diff) | |
download | ramaskrik-program-d08fa4e375748f0f2232ea75645cb15126155047.tar.gz ramaskrik-program-d08fa4e375748f0f2232ea75645cb15126155047.tar.bz2 ramaskrik-program-d08fa4e375748f0f2232ea75645cb15126155047.zip |
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...)
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")) |