Created
October 14, 2010 04:23
-
-
Save weatheredwatcher/625572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GetLastFmFeed | |
def self.displayFeed | |
require 'rss' | |
require 'open-uri' | |
@lastfmArray = [] | |
rss = RSS::Parser.parse open('http://ws.audioscrobbler.com/1.0/user/minasmir/recenttracks.rss').read, false | |
puts rss.channel.title | |
@lastfmArray.push "<p class='section'>Last.FM Feed</p>" | |
@lastfmArray.push "<ul style='font-size:11px;'>" | |
rss.items.each_with_index do |item,i| | |
puts "" if i.zero? or item.date.day != rss.items[i-1].date.day | |
line = "<li><a href=\"#{item.link}\">#{item.title}</a></li> " | |
@lastfmArray.push line | |
end | |
@lastfmArray.push "</ul>" | |
return @lastfmArray | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment