~sivers/sive.rs

sive.rs/script/podcast.rb -rwxr-xr-x 557 bytes
5fcf6634 — Derek Sivers cover and hardcover 20 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
require_relative 'init.rb'

files = Dir[ROOT + 'content/podcast/*'].sort.reverse
template = File.read(ROOT + 'templates/podcast.mustache')

podcast = files.map {|fn| meta(fn)}

vars = {}
vars[:bodyid] = 'podcast'
vars[:pagetitle] = 'podcast'
vars[:pagedescription] = 'Derek Sivers podcast'
vars[:seasons] = []
seasons = podcast.map {|x| x[:season]}.uniq.sort.reverse
seasons.each do |season|
  vars[:seasons] << {
    season: season,
    podcasts: podcast.filter {|x| x[:season] == season}
  }
end

wput('podcast', page(template, vars))