summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/lastfm.rb
diff options
context:
space:
mode:
authorRaine Virta <rane@kapsi.fi>2009-03-04 20:43:07 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-03-05 18:59:07 +0100
commitf5849552e821b847bdb2034052ec91f0bf544be3 (patch)
treeb5d10b5d2f0f30cf49aae48af59b7a70610dbcca /data/rbot/plugins/lastfm.rb
parent716f063f4473fbd45abf49e40c06826c85cc9dad (diff)
lastfm: fix bug of album not showing in nowplaying if there's no year
Diffstat (limited to 'data/rbot/plugins/lastfm.rb')
-rw-r--r--data/rbot/plugins/lastfm.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index ee9ef5ba..f97da63f 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -315,10 +315,15 @@ class LastFmPlugin < Plugin
artist = first.elements["artist"].text
track = first.elements["name"].text
albumtxt = first.elements["album"].text
- album = ""
- if albumtxt
+ album = if albumtxt
year = get_album(artist, albumtxt)[2]
- album = "[#{albumtxt}, #{year}]" if year
+ if year
+ "[#{albumtxt}, #{year}]"
+ else
+ "[#{albumtxt}]"
+ end
+ else
+ nil
end
past = nil
date = XPath.first(first, "//date")