]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/imdb.rb
lastfm plugin: refactoring
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / imdb.rb
index ad9bbf588c6c6f0408e84b5619f0e3d635c229a3..ce9ae335c9e0b14eaa29fdc94e24dd60bc36ca41 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)
 
@@ -134,7 +135,7 @@ class Imdb
       country = nil
       data = grab_info(/Country/, resp.body)
       if data
-        country = data.ircify_html
+        country = data.ircify_html.gsub(' / ','/')
       end
 
       info << [title, "(#{country}, #{date})", extra, dir ? "[#{dir}]" : nil, ": http://us.imdb.com#{sr}"].compact.join(" ")
@@ -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")