summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-05 22:23:03 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-05 22:23:03 +0000
commit117180ab01270e60cf883acfe6382223ccb67f6e (patch)
treee85a60428c1cf6085bdc3a42a024187e47f1b04a /data
parent7fa6a62c6c54e958459559235997972106ce26d6 (diff)
lastfm plugin: don't be silent when no events are found
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/lastfm.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index e0fa8a3a..44e2e0b4 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -62,7 +62,10 @@ class LastFmPlugin < Plugin
# matches are:
# 1. day 2. moth 3. year 4. url_who 5. who 6. url_where 7. where 8. how_many
pre_events = page.scan(/<tr class="vevent\s+\w+\s+\S+?-(\d\d)-(\d\d)-(\d\d\d\d)\s*">.*?<a class="url summary" href="(\/event\/\d+)">(.*?)<\/a>.*?<a href="(\/venue\/\d+)">(.*?)<\/a>.*?<td class="attendance">(.*?)<\/td>\s+<\/tr>/m)
- debug pre_events.inspect
+ # debug pre_events.inspect
+ if pre_events.empty?
+ m.reply "No events found in #{location}, sorry"
+ end
pre_events.each { |day, month, year, url_who, who, url_where, where, how_many|
date = Time.utc(year.to_i, month.to_i, day.to_i)
url = LASTFM + url_who
@@ -71,7 +74,7 @@ class LastFmPlugin < Plugin
attendance = how_many.ircify_html
events << LastFmEvent.new(url, date, artist, loc, attendance)
}
- debug events.inspect
+ # debug events.inspect
events[0..2].each { |event|
disp_events << "%s %s @ %s (%s) %s" % [event.date.strftime("%a %b, %d %Y"), event.artist, event.location, event.attendance, event.url]