From 117180ab01270e60cf883acfe6382223ccb67f6e Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 5 Apr 2007 22:23:03 +0000 Subject: lastfm plugin: don't be silent when no events are found --- data/rbot/plugins/lastfm.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'data') 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(/.*?(.*?)<\/a>.*?(.*?)<\/a>.*?(.*?)<\/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] -- cgit v1.2.3