rlivsey / livsey.org

Source to http://livsey.org

This URL has Read+Write access

rlivsey (author)
Sun Dec 21 10:10:10 -0800 2008
commit  cd5c944e82d292e508135babe2870609accc4a03
tree    cd9107cd907cf20266b1045e4ec4a9bfb6f020b1
parent  b6600165bbf97e1858487a2326d4d1fa1663ead7
livsey.org / application.rb
100644 43 lines (33 sloc) 1.298 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
class Livsey < Merb::Controller
 
  def _template_location(action, type = nil, controller = controller_name)
    controller == "layout" ? "layout.#{action}.#{type}" : "#{action}.#{type}"
  end
 
  def index
    
    shared = Merb::Cache[:default].fetch("shared", :interval => 300) do
      open('http://www.google.com/reader/public/atom/user%2F02567817048599663160%2Fstate%2Fcom.google%2Fbroadcast') do |stream|
        stream.read
      end
    end
    
    tweets = Merb::Cache[:default].fetch("tweets", :interval => 300) do
      open('http://twitter.com/statuses/user_timeline/12782772.rss') do |stream|
        stream.read
      end
    end
    
    lastfm = Merb::Cache[:default].fetch("music", :interval => 300) do
      open('http://ws.audioscrobbler.com/1.0/user/livsey/recenttracks.rss') do |stream|
        stream.read
      end
    end
    
    github = Merb::Cache[:default].fetch("github", :interval => 300) do
      open('http://github.com/api/v1/json/rlivsey') do |stream|
        stream.read
      end
    end
    
    @shared = SimpleRSS.parse(shared)
    @tweets = SimpleRSS.parse(tweets)
    @lastfm = SimpleRSS.parse(lastfm)
    
    code = JSON.parse(github)
    @repos = code['user']['repositories'].sort{|x, y| x['name'] <=> y['name'] }
    
    render
  end
  
end