]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/lastfm.rb
rss plugin: check for unhandled Atom feeds (old Ruby/RSS library)
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / lastfm.rb
index 1efb58fd40db571993e6b6ebad1c39242a5157f1..6482b543067ce63c90a1c8e6d0f3ffeadcd40469 100644 (file)
@@ -28,10 +28,10 @@ class ::LastFmEvent
 
     if @artists.length > 10 #more than 10 artists and it floods
       diff = @artists.length - 10
-      @artist_string = @artists[0..10].join(', ')
+      @artist_string = Bold + @artists[0..10].join(', ') + Bold
       @artist_string << _(" and %{n} more...") % {:n => diff}
     else
-      @artist_string = @artists.join(', ')
+      @artist_string = Bold + @artists.join(', ') + Bold
     end
   end
 
@@ -85,8 +85,10 @@ class LastFmPlugin < Plugin
       _("lastfm set nick <user> => associate your current irc nick with a last.fm user. lastfm set verb <present> <past> => set your preferred now playing verb. default \"listening\" and \"listened\".")
     when :who
       _("lastfm who [<nick>] => show who <nick> is at last.fm. if <nick> is empty, show who you are at lastfm.")
+    when :compare
+      _("lastfm compare <nick1> <nick2> => show musical taste compatibility between nick1 and nick2.")
     else
-      _("lastfm [<user>] => show your or <user>'s now playing track at lastfm. np [<user>] => same as 'lastfm'. other topics: events, artist, album, track, now, set, who")
+      _("lastfm [<user>] => show your or <user>'s now playing track at lastfm. np [<user>] => same as 'lastfm'. other topics: events, artist, album, track, now, set, who, compare")
     end
   end
 
@@ -108,7 +110,7 @@ class LastFmPlugin < Plugin
 
     doc = Document.new xml.body
     if xml.class == Net::HTTPInternalServerError
-      if doc.root.attributes["status"] == "failed"
+      if doc.root and doc.root.attributes["status"] == "failed"
         m.reply doc.root.elements["error"].text
       else
         m.reply _("Could not retrieve events")
@@ -122,7 +124,7 @@ class LastFmPlugin < Plugin
       venue = e.elements["venue"].elements["name"].text
       city = e.elements["venue"].elements["location"].elements["city"].text
       country =  e.elements["venue"].elements["location"].elements["country"].text
-      h[:location] = Bold + venue + Bold + " #{city}, #{country}"
+      h[:location] = Underline + venue + Underline + " #{Bold + city + Bold}, #{country}"
       date = e.elements["startDate"].text.split
       h[:date] = Time.utc(date[3].to_i, date[2], date[1].to_i)
       h[:desc] = e.elements["description"].text