Skip to content

Commit

Permalink
cache and expire. change color
Browse files Browse the repository at this point in the history
  • Loading branch information
ohac committed May 22, 2009
1 parent a79b81a commit a995a2a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ricalv.rb
Expand Up @@ -62,7 +62,8 @@ def escseq(str = '')
when /http:\/\//
FileUtils.mkdir_p(CACHEDIR)
d = CACHEDIR + '/' + Digest::MD5.hexdigest(fn)
`wget -q -O #{d} #{fn}`
expire = File.exist?(d) && (File.mtime(d).to_i + 10 * 60) # 10 min
`wget -q -O #{d} #{fn}` if !expire || Time.now.to_i > expire
d
else
HOME + '/' + fn
Expand All @@ -73,7 +74,7 @@ def escseq(str = '')
File.open(fn) { |f| Icalendar.parse(f) }
}

colors = [ '33', '35', '36', '37' ] * 10 # TODO
colors = [ '31', '32', '33', '35', '36', '37' ] * 10 # TODO
items = calss.map { |cals|
color = colors.shift
cals.map { |cal|
Expand Down

0 comments on commit a995a2a

Please sign in to comment.