From a5f2eb0e77880ed5582ad39692349b31a50f9b4d Mon Sep 17 00:00:00 2001 From: Casey Link Date: Mon, 27 Oct 2008 15:54:16 -0400 Subject: * (lastfm) fix a bug resulting in the change of the lastfm api output. now_playing works again Lastfm removed the element from track's which are currently being played, which caused the plugin to die. Now we detect if the element exists. --- data/rbot/plugins/lastfm.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'data/rbot/plugins') 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" -- cgit v1.2.3