alberanid/imdbpy — pull request #8 by darklow (2013-03-28 14:53:42+00:00)
Title: Fixed title2imdb() method search by adding imdbIndex to canonical title

Imdb has changed `imdbIndex` position in title from previous format:
`Title (2000/I)` to
`Title (I) (2000)`
See: http://akas.imdb.com/find?q=the+beach

Also there are still problems with episodes. To fix that and also `title2imdbid` could be improved even more if we separate string by which search is performed with string to compare against. I noticed more precise results are, if you perform search for titles without canonical title but match results with canonical.

For example if you search `Road, The (2009)` first result is `Glee` (our 3rd). If you search `The Road (2009)` then first result matches.

I could do the refactoring if you agree on this change to separate search string with match string.

Also i created unit test to test different kind of situations while was fixing this bug.
Here are results before changes `python imdbpy-dev/tests/to_imdbid.py`:
```
Search: Pitt, Brad
ImdbID: None
Search: Jackson, Michael (I)
ImdbID: None
Search: Road (2005)
ImdbID: 0347884 <<< one match only
Search: The Road (2009)
ImdbID: None
Search: The Beach (2000/I)
ImdbID: None
Search: "The Office" (2005)
ImdbID: None
Search: "The Office" (2005) {Health Care (#1.3)}
ImdbID: None
```

After fix:
```
Search: Pitt, Brad
ImdbID: 0000093
Search: Jackson, Michael (I)
ImdbID: 0001391
Search: Road (2005)
ImdbID: 0347884
Search: Road, The (2009)
ImdbID: 0898367
Search: Beach (I), The (2000)
ImdbID: 0163978
Search: "Office, The" (2005)
ImdbID: 0386676
Search: "Office, The" (2005) {Health Care (#1.3)}
ImdbID: None
```

If you are interested (it is never too late to start the tests :) i can also submit my test file.