summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorCasey Link <unnamedrambler@gmail.com>2008-10-27 15:54:16 -0400
committerCasey Link <unnamedrambler@gmail.com>2008-10-27 16:29:49 -0400
commita5f2eb0e77880ed5582ad39692349b31a50f9b4d (patch)
treee60c5f573cd22b7ca9a2d2f02b520e21476dbe65 /data/rbot/plugins
parent41ea4232df0ed0b3f922b0476444ca8e38f3301f (diff)
* (lastfm) fix a bug resulting in the change of the lastfm api output. now_playing works again
Lastfm removed the <date> element from track's which are currently being played, which caused the plugin to die. Now we detect if the <date> element exists.
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/lastfm.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index d6a3eeea..8439d350 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -245,8 +245,12 @@ class LastFmPlugin < Plugin
year = get_album(artist, albumtxt)[2]
album = "[#{albumtxt}, #{year}] " if year
end
- date = first.elements["date"].attributes["uts"]
- past = Time.at(date.to_i)
+ past = nil
+ date = XPath.first(first, "//date")
+ if date != nil
+ time = date.attributes["uts"]
+ past = Time.at(time.to_i)
+ end
if now == "true"
verb = _("listening")
if @registry.has_key? "#{m.sourcenick}_verb_present"