summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-03-07 11:10:05 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-03-07 11:10:05 +0100
commitb46397e1cf9698942c2a85cec42e9185cfb1bf29 (patch)
tree7c9062f3ee72b192f34da5fcb0d8b857056c82ae /data
parent1beaf6be293abff44a9169ee5b3451edc4c213dd (diff)
lastfm: handle no events when searching by venue
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/lastfm.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 11154069..9559f764 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -50,6 +50,15 @@ class ::LastFmEvent
end
define_structure :LastFmVenue, :id, :city, :street, :postal, :country, :name, :url, :lat, :long
+class ::Struct::LastFmVenue
+ def to_s
+ str = self.name.dup
+ if self.country
+ str << " (" << [self.city, self.country].compact.join(", ") << ")"
+ end
+ str
+ end
+end
class LastFmPlugin < Plugin
include REXML
@@ -190,6 +199,7 @@ class LastFmPlugin < Plugin
end
venue = venues.first
uri = "#{APIURL}method=venue.getevents&venue=#{venue.id}"
+ emptymsg = _("no events found at %{venue}") % {:venue => venue.to_s}
elsif artist
uri = "#{APIURL}method=artist.getevents&artist=#{CGI.escape artist.to_s}"
emptymsg = _("no events found by %{artist}") % {:artist => artist.to_s}