diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-07 10:52:38 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-07 10:52:38 +0000 |
commit | ba751e503366abe4b88b1635b848c5e532c882f6 (patch) | |
tree | d3c1fc92ffd1ac4dd38779264fa406a7b89b4ce3 | |
parent | 7d549a69b2d7745e976838758c3573799f1d5dfa (diff) |
imdb plugin: better catching; sort movies before TV series
-rw-r--r-- | data/rbot/plugins/imdb.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb index e5f3b7c2..959b2169 100644 --- a/data/rbot/plugins/imdb.rb +++ b/data/rbot/plugins/imdb.rb @@ -202,7 +202,7 @@ class Imdb if year = opts[:movies_in_year] filmoyear = @bot.httputil.get(IMDB + sr + "filmoyear") if filmoyear - info << filmoyear.scan(/#{TITLE_MATCH} \(#{year}\)[^\]]*\[(.*)\]([^<]+)?(?:$|\s*<)/) + info << filmoyear.scan(/#{TITLE_MATCH} \(#{year}\)[^\[\n]*\[(.*)\]([^<]+)?(?:$|\s*<)/) end return info end @@ -272,10 +272,21 @@ class Imdb urls.map { |url| info = info_name(url, :movies_in_year => year) + debug info.inspect + name_url = info.first data = info[1] movies = [] + # Sort by pre-title putting movies before TV series + debug data.map { |a| a[1] }.join("\n") + data.sort! { |a, b| + aclip = a[1][0,5] + bclip = b[1][0,5] + quot = '"' + (aclip == quot ? 1 : -1) <=> (bclip == quot ? 1 : -1) + } + debug data.map { |a| a[1] }.join("\n") data.each { |url, pre_title, pre_roles, extra| title = fix_article(pre_title.ircify_html) role_array = pre_roles.split(/\]\s+\[/).map { |txt| |