summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-03-07 11:32:42 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-03-07 11:32:42 +0100
commit3cdd601ba03566e599d17de5c70a302dbe98734d (patch)
tree55fa3d9e9d2c2c9d9e8350a44b714842b8c28401
parentc3d268f88acfa1ebabacc79258e87ffe767d0624 (diff)
lastfm: clean up sort order events search mappings
Put some requirements for the sort_order specification, to prevent lastfm events at alan lomax to map lomax as a sort order. Also make the 'in' and 'order' words optional within the optional sord order block, rather than aside, to prevent them from being ignored in venue names.
-rw-r--r--data/rbot/plugins/lastfm.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 17107fc1..22bd1130 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -757,15 +757,18 @@ end
event_map_options = {
:action => :find_events,
- :requirements => { :num => /\d+/ },
+ :requirements => {
+ :num => /\d+/,
+ :sort_order => /(?:asc|desc)(?:ending)?/
+ },
:thread => true
}
plugin = LastFmPlugin.new
-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 [: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