]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
lastfm: fix bug of album not showing in nowplaying if there's no year
authorRaine Virta <rane@kapsi.fi>
Wed, 4 Mar 2009 18:43:07 +0000 (20:43 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 5 Mar 2009 17:59:07 +0000 (18:59 +0100)
data/rbot/plugins/lastfm.rb

index ee9ef5bab92c92bf8a6ce050900ba312621496d4..f97da63f453f04911008dda96d1dbb4a2a95ba08 100644 (file)
@@ -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")