From 52859bb65d4de803a39cd8bda46618d2aea64c50 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 3 Jul 2008 21:57:18 +0200 Subject: lastfm plugin: better handling missing album in playing info --- data/rbot/plugins/lastfm.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index d99a9526..2e5dc3f5 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -235,8 +235,11 @@ class LastFmPlugin < Plugin artist = first.elements["artist"].text track = first.elements["name"].text albumtxt = first.elements["album"].text - year = get_album(artist, albumtxt)[2] - album = "[#{albumtxt}, #{year}] " unless albumtxt == nil or year.length == 1 + album = "" + if albumtxt + year = get_album(artist, albumtxt)[2] + album = "[#{albumtxt}, #{year}] " if year + end date = first.elements["date"].attributes["uts"] past = Time.at(date.to_i) if now == "true" -- cgit v1.2.3