Code

Fixed lyricwiki plugin
authorJeffrey Middleton <jefromi@gmail.com>
Tue, 10 Mar 2009 13:49:46 +0000 (08:49 -0500)
committerJeffrey Middleton <jefromi@gmail.com>
Tue, 10 Mar 2009 13:49:46 +0000 (08:49 -0500)
LyricWiki returns a page with "Not found" in place of the song lyrics if
the song is not found; check for this.

lyrics/02-lyricwiki.rb

index a90cb2ae80366e82e11b0c5956d38326b55624c8..9c9f66378cd81e6dc74f03aa755586f42f436863 100755 (executable)
@@ -29,4 +29,5 @@ url = "http://lyricwiki.org/api.php" + \
 response = Net::HTTP.get(URI.parse(url))
 
 exit(2) unless response =~ /<pre>\s*(.*?)\s*<\/pre>/im
+exit(2) if $1 == "Not found"
 puts $1