Class: Sh::Lyrics
Class Method Summary collapse
Class Method Details
.get_lyrics(song) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sh_lyrics.rb', line 8 def Lyrics.get_lyrics song artist, title = song.artist.name, song.title lyrics = nil if artist and title url = "http://lyrical.heroku.com/api?format=plain" url << "&artist=#{CGI.escape(artist)}" url << "&song=#{CGI.escape(title)}" lyrics = open(url).read lyrics = nil if lyrics.empty? end return lyrics end |