]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
imdb plugin: imdb.popular and imdb.exact config options to determine which results...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 5 Apr 2007 07:52:05 +0000 (07:52 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 5 Apr 2007 07:52:05 +0000 (07:52 +0000)
data/rbot/plugins/imdb.rb

index 2f44a6b51393550b580c55bd76a1af1daf62d64d..3f750793cc1969a86e38a34ce0ebdb679e5b4163 100644 (file)
@@ -41,8 +41,8 @@ class Imdb
 
     if resp.code == "200"
       m = []
-      m << TITLE_OR_NAME_MATCH.match(resp.body)
-      if resp.body.match(/\(Exact Matches\)<\/b>/)
+      m << TITLE_OR_NAME_MATCH.match(resp.body) if @bot.config['imdb.popular']
+      if resp.body.match(/\(Exact Matches\)<\/b>/) and @bot.config['imdb.exact']
         m << TITLE_OR_NAME_MATCH.match($')
       end
       m.compact!
@@ -230,6 +230,13 @@ class Imdb
 end
 
 class ImdbPlugin < Plugin
+  BotConfig.register BotConfigBooleanValue.new('imdb.popular',
+    :default => true,
+    :desc => "Display info on popular IMDB entries matching the request closely")
+  BotConfig.register BotConfigBooleanValue.new('imdb.exact',
+    :default => true,
+    :desc => "Display info on IMDB entries matching the request exactly")
+
   def help(plugin, topic="")
     "imdb <string> => search http://www.imdb.org for <string>"
   end