]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/imdb.rb
search plugin: gcalc command thanks to epitron
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / imdb.rb
index ad9bbf588c6c6f0408e84b5619f0e3d635c229a3..7887655dfd641da538940a5f798fad2ce9029f87 100644 (file)
@@ -25,7 +25,8 @@ class Imdb
   end
 
   def search(rawstr)
-    str = URI.escape(rawstr) << ";site=aka"
+    str = URI.escape(rawstr)
+    str << ";site=aka" if @bot.config['imdb.aka']
     return do_search(str)
   end
 
@@ -119,7 +120,7 @@ class Imdb
       m = /<title>([^<]*)<\/title>/.match(resp.body)
       return nil if !m
       title_date = m[1]
-      pre_title, date, extra = title_date.scan(/^(.*)\((\d\d\d\d(?:[IV]+)?)\)\s*(.+)?$/).first
+      pre_title, date, extra = title_date.scan(/^(.*)\((\d\d\d\d(?:\/[IV]+)?)\)\s*(.+)?$/).first
       pre_title.strip!
       title = fix_article(pre_title)
 
@@ -245,6 +246,9 @@ class Imdb
 end
 
 class ImdbPlugin < Plugin
+  BotConfig.register BotConfigBooleanValue.new('imdb.aka',
+    :default => true,
+    :desc => "Look for IMDB matches also in translated titles and other 'also known as' information")
   BotConfig.register BotConfigBooleanValue.new('imdb.popular',
     :default => true,
     :desc => "Display info on popular IMDB entries matching the request closely")