]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
lastfm: refactor map options for events search
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 7 Mar 2009 10:22:27 +0000 (11:22 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 7 Mar 2009 10:29:45 +0000 (11:29 +0100)
data/rbot/plugins/lastfm.rb

index 6e899c1a62f387e574656a8ae947b59f7c0b48ba..17107fc1f512cc3eac09063195f7b67a9bbebb5a 100644 (file)
@@ -755,11 +755,17 @@ class LastFmPlugin < Plugin
   end
 end
 
+event_map_options = {
+ :action => :find_events,
+ :requirements => { :num => /\d+/ },
+ :thread => true
+}
+
 plugin = LastFmPlugin.new
-plugin.map 'lastfm [:num] event[s] in *location [sort[ed] by :sort_by] [in] [:sort_order] [order]', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
-plugin.map 'lastfm [:num] event[s] by *who [sort[ed] by :sort_by] [in] [:sort_order] [order]', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
-plugin.map 'lastfm [:num] event[s] at *venue [sort[ed] by :sort_by] [in] [:sort_order] [order]', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
-plugin.map 'lastfm [:num] event[s] [for] *who [sort[ed] by :sort_by] [in] [:sort_order] [order]', :action => :find_events, :requirements => { :num => /\d+/ }, :thread => true
+plugin.map 'lastfm [:num] event[s] in *location [sort[ed] by :sort_by] [in] [:sort_order] [order]', event_map_options.dup
+plugin.map 'lastfm [:num] event[s] by *who [sort[ed] by :sort_by] [in] [:sort_order] [order]', event_map_options.dup
+plugin.map 'lastfm [:num] event[s] at *venue [sort[ed] by :sort_by] [in] [:sort_order] [order]', event_map_options.dup
+plugin.map 'lastfm [:num] event[s] [for] *who [sort[ed] by :sort_by] [in] [:sort_order] [order]', event_map_options.dup
 plugin.map 'lastfm artist *artist', :action => :find_artist, :thread => true
 plugin.map 'lastfm album *album [by *artist]', :action => :find_album
 plugin.map 'lastfm track *track', :action => :find_track, :thread => true