summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaine Virta <rane@kapsi.fi>2009-02-25 02:15:48 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-26 00:39:48 +0100
commitbe6d4c5c331bec69d442368bfb91e31a9fa9cdb5 (patch)
treea6526fca2fcc51fc698ec2d7da7850e28a31803d
parent1f189174e58ae460ea359df6c2e2a4692addbc33 (diff)
lastfm: find events by venue
-rw-r--r--data/rbot/plugins/lastfm.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index d1115ed8..dca34703 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -170,11 +170,16 @@ class LastFmPlugin < Plugin
location = params[:location]
artist = params[:who]
+ venue = params[:venue]
user = resolve_username(m, params[:user])
if location
uri = "#{APIURL}method=geo.getevents&location=#{CGI.escape location.to_s}"
emptymsg = _("no events found in %{location}") % {:location => location.to_s}
+ elsif venue
+ venues = search_venue_by(:name => venue.to_s, :limit => 1)
+ venue = venues.first
+ uri = "#{APIURL}method=venue.getevents&venue=#{venue.id}"
elsif artist
uri = "#{APIURL}method=artist.getevents&artist=#{CGI.escape artist.to_s}"
emptymsg = _("no events found by %{artist}") % {:artist => artist.to_s}
@@ -667,6 +672,7 @@ end
plugin = LastFmPlugin.new
plugin.map 'lastfm [:num] event[s] in *location', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
plugin.map 'lastfm [:num] event[s] by *who', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
+plugin.map 'lastfm [:num] event[s] at *venue', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
plugin.map 'lastfm [:num] event[s] [for] *who', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
plugin.map 'lastfm artist *artist', :action => :find_artist, :thread => true
plugin.map 'lastfm album *album [by *artist]', :action => :find_album