summaryrefslogtreecommitdiff
path: root/climbing.rb
blob: 7360601f3aaf40782e3b65b7ac5b7116972b7d2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
require_relative 'lib'

climbing = Dir[File.join(MEDIA_DIR, 'climbing', '*')].select { |f| File.directory? f }.sort.reverse
html = File.read(File.join(SNIPPETS, 'head.html'))
html += nav 'climbing'
climbing.each do |dir|
  date = File.basename(dir)
  html += "<section id='#{date}'>"
  html += "<h1>#{date}</h1>"
  mp4 = Dir[File.join(dir, '*.mp4')].first.sub(MEDIA_DIR, MEDIA_URL)
  webm = Dir[File.join(dir, '*.webm')].first.sub(MEDIA_DIR, MEDIA_URL)
  poster = Dir[File.join(dir, '*.webp')].first.sub(MEDIA_DIR, MEDIA_URL)
  html += "<video controls preload='none' poster='#{poster}'>
          <source src='#{webm}' type='video/webm'>
          <source src='#{mp4}' type='video/mp4'>
          <a href=#{mp4}>#{mp4}</a>
        </video><p>
        "
  html += File.read(File.join(dir, 'README'))
  html += '</section>'
end
html += File.read(File.join(SNIPPETS, 'tail.html'))
print_html 'climbing', html