diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-06 22:20:54 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-06 22:20:54 +0000 |
commit | a7d50aeb63957485de7d423a4b2cc73f5cbe435a (patch) | |
tree | 8d8d71566dcfc8eb9dad2acaf1623c4b3b00e358 /data | |
parent | a0a91c1259343ab4e3a39f39c1b8d449d1b77648 (diff) |
imdb plugin: improve title fixing
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/imdb.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb index 543a9582..df746b85 100644 --- a/data/rbot/plugins/imdb.rb +++ b/data/rbot/plugins/imdb.rb @@ -106,10 +106,14 @@ class Imdb def fix_article(org_tit) title = org_tit.dup + debug title.inspect + if title.match(/^"(.*)"$/) + return "\"#{fix_article($1)}\"" + end if @bot.config['imdb.fix_article'] and title.gsub!(FINAL_ARTICLE_MATCH, '') art = $1.dup debug art.inspect - if art[-1,1].match(/[a-z]/) + if art[-1,1].match(/[A-Za-z]/) art << " " end return art + title @@ -135,7 +139,7 @@ class Imdb title_date = m[1] pre_title, date, extra = title_date.scan(/^(.*)\((\d\d\d\d(?:\/[IV]+)?)\)\s*(.+)?$/).first pre_title.strip! - title = fix_article(pre_title) + title = fix_article(pre_title.ircify_html) dir = nil data = grab_info(/Directors?/, resp.body) @@ -223,7 +227,7 @@ class Imdb what = str.match(/<a name="[^"]+">([^<]+)<\/a>/)[1] rescue nil next unless what movies[what] = str.scan(TITLE_MATCH)[0..2].map { |url, tit| - fix_article(tit) + fix_article(tit.ircify_html) } } end |