summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-03 21:57:18 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-03 21:57:18 +0200
commit52859bb65d4de803a39cd8bda46618d2aea64c50 (patch)
treea5fb1ee4d4d016f231669e28ce1effad9f5e27f5 /data/rbot/plugins
parent34857acfa4f7aab4dc17d43db6337d8f72a449ec (diff)
lastfm plugin: better handling missing album in playing info
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/lastfm.rb7
1 files changed, 5 insertions, 2 deletions
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"