-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathschedule.rb
More file actions
executable file
·52 lines (43 loc) · 1.12 KB
/
schedule.rb
File metadata and controls
executable file
·52 lines (43 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env ruby
require "csv"
require "time"
prev_day = nil
prev_start = nil
prev_desc = nil
fmt = "%H:%M"
def livestream?(title)
title.match?(/Announcements/) || title.match?(/Talks/) || title.match?(/Keynote/)
end
CSV.foreach(ARGV[0], headers: true).each do |row|
day = row["Day"]
start = row["Start"]
desc = row["Description"].strip
if prev_day != nil
# we have data to output
d1 = Time.parse(prev_start)
d2 = Time.parse(start)
clockface = "#{d1.strftime("%l.%M").strip}.png"
puts "- timeImg: #{clockface}"
puts " time: #{d1.strftime(fmt)}-#{d2.strftime(fmt)}"
puts " day#{day}: true"
puts " livestream: #{livestream?(prev_desc)}"
puts " title: #{prev_desc}"
if prev_desc == "Opening Keynote"
puts " groupId: key-open"
elsif prev_desc == "Closing Keynote"
puts " groupId: key-close"
elsif prev_desc =~ /Group (\d) Talks/
puts " groupId: #{$1}"
end
end
if desc == "End"
# end of day, reset
prev_day = nil
prev_start = nil
prev_desc = nil
else
prev_day = day
prev_start = start
prev_desc = desc
end
end