diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-07 11:10:05 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-07 11:10:05 +0100 |
commit | b46397e1cf9698942c2a85cec42e9185cfb1bf29 (patch) | |
tree | 7c9062f3ee72b192f34da5fcb0d8b857056c82ae /data | |
parent | 1beaf6be293abff44a9169ee5b3451edc4c213dd (diff) |
lastfm: handle no events when searching by venue
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 10 |
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} |