diff options
-rw-r--r-- | data/rbot/plugins/imdb.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb index 82afd94a..94e4e571 100644 --- a/data/rbot/plugins/imdb.rb +++ b/data/rbot/plugins/imdb.rb @@ -153,7 +153,7 @@ class Imdb country = data.ircify_html.gsub(' / ','/') end - info << [title, "(#{country}, #{date})", extra, dir ? "[#{dir}]" : nil, ": http://us.imdb.com#{sr}"].compact.join(" ") + info << [title, "(#{country}, #{date})", extra, dir ? "[#{dir}]" : nil, opts[:nourl] ? nil : ": http://us.imdb.com#{sr}"].compact.join(" ") return info if opts[:title_only] @@ -405,9 +405,27 @@ class ImdbPlugin < Plugin attr_reader :i + TITLE_URL = %r{^http://(?:[^.]+\.)?imdb.com(/title/tt\d+/)} + def imdb_filter(s) + loc = Utils.check_location(s, TITLE_URL) + if loc + sr = loc.first.match(TITLE_URL)[1] + extra = $2 + res = i.info_title(sr, :nourl => true, :characters => (extra == 'fullcredits')) + debug res + if res + return {:title => res.first, :content => res.last} + else + return nil + end + end + return nil + end + def initialize super @i = Imdb.new(@bot) + @bot.register_filter(:imdb, :htmlinfo) { |s| imdb_filter(s) } end # Find a person or movie on IMDB. A :type (name/title, default both) can be |