diff options
author | Raine Virta <rane@kapsi.fi> | 2009-02-03 14:44:05 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-02-07 13:35:40 +0100 |
commit | 2b81b5d6ec06fbf9e32300eeb9caece8c26d33b7 (patch) | |
tree | b300b309cb77bb8de99ac7d6311074c6d3c27b6e /data/rbot | |
parent | e22cb6b8d589f523bfe6d99c5f44b18ad5091def (diff) |
lastfm plugin: a small change in the last.fm api had broken the artist command
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index 8439d350..67f8d5f7 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -146,7 +146,7 @@ class LastFmPlugin < Plugin } m.reply disp_events.join(' | '), :split_at => /\s+\|\s+/ - end + end def tasteometer(m, params) opts = { :cache => false } @@ -159,7 +159,7 @@ class LastFmPlugin < Plugin return end if xml.class == Net::HTTPInternalServerError - if doc.root.elements["error"].attributes["code"] == "7" then + if doc.root.elements["error"].attributes["code"] == "7" then error = doc.root.elements["error"].text error.match(/Invalid username: \[(.*)\]/); if @registry.has_key? $1 and not params[:recurs] @@ -216,7 +216,7 @@ class LastFmPlugin < Plugin return end if xml.class == Net::HTTPBadRequest - if doc.root.elements["error"].text == "Invalid user name supplied" then + if doc.root.elements["error"].text == "Invalid user name supplied" then if @registry.has_key? user and not params[:recurs] params[:who] = @registry[ user ] params[:recurs] = true @@ -280,7 +280,7 @@ class LastFmPlugin < Plugin end first = doc.root.elements["artist"] artist = first.elements["name"].text - playcount = first.elements["stats"].elements["plays"].text + playcount = first.elements["stats"].elements["playcount"].text listeners = first.elements["stats"].elements["listeners"].text summary = first.elements["bio"].elements["summary"].text m.reply _("%{b}%{a}%{b} has been played %{c} times and is being listened to by %{l} people.") % {:b => Bold, :a => artist, :c => playcount, :l => listeners} @@ -338,7 +338,7 @@ class LastFmPlugin < Plugin playcount = first.elements["playcount"].text album = first.elements["name"].text date = first.elements["releasedate"].text - unless date.strip.length < 2 + unless date.strip.length < 2 year = date.strip.split[2].chop end result = [artist, album, year, playcount] @@ -375,7 +375,7 @@ class LastFmPlugin < Plugin nick = "" if params[:who] nick = params[:who].to_s - else + else nick = m.sourcenick end if @registry.has_key? nick |