0

I am referencing this stackoverflow answer.

https://stackoverflow.com/a/20948609/4891914

I can't comment on it because my reputation isn't above 50. I used the exact code but get this error:

Traceback (most recent call last):
  File "search.py, line 47, in <module>
    print inglorious['soundtrack']
  File "/usr/local/lib/python2.7/dist-packages/imdb/utils.py", line 1469, in __getitem__
    rawData = self.data[key]
KeyError: 'soundtrack'

I also tried this variant:

from imdb import IMDb
ia = IMDb('sql', uri='mysql://username:password@localhost/imdb')
inglorious = ia.search_movie('Inglorious Basterds')[0]
ia.update(inglorious, info=['soundtrack'])
soundtrack = inglorious.get('soundtrack')
print soundtrack

And it prints "None". When imdbpy2sql.py was run the file soundtracks.list.gz did exist in the directory where all the other imdb files where. I did verify that on imdb.com a soundtrack does exist for that movie.

http://www.imdb.com/title/tt0361748/soundtrack?ref_=tt_trv_snd

Any help would be greatly appreciated.

UPDATE MySQL queries on info_type and movie_info table;

SELECT * FROM info_type WHERE info='alternate versions' OR info='goofs' OR info='crazy credits' OR info='soundtrack' OR info='quotes' OR info='trivia';

  id | info
  -----------------------
  11 | alternate versions
  12 | crazy credits
  13 | goofs
  15 | quotes
  14 | soundtrack
  17 | trivia

SELECT COUNT(*) FROM movie_info WHERE info_type_id=11;
  COUNT(*)
  19716
SELECT COUNT(*) FROM movie_info WHERE info_type_id=12;
  COUNT(*)
  21158
SELECT COUNT(*) FROM movie_info WHERE info_type_id=13;
  COUNT(*)
  222002
SELECT COUNT(*) FROM movie_info WHERE info_type_id=14;
  COUNT(*)
  0
SELECT COUNT(*) FROM movie_info WHERE info_type_id=15;
  COUNT(*)
  693707
SELECT COUNT(*) FROM movie_info WHERE info_type_id=17;
  COUNT(*)
  531702

So the issue is probably with the imdbpy2sql.py script. As stated before any help in debugging this issue will be greatly appreciated.

Community
  • 1
  • 1
Tool Man
  • 311
  • 4
  • 13

2 Answers2

0

Your best option to understand what's going on is to store the output of your command, adding 2>&1 | tee imdbpy2sql-output.log at the end of the command line (on a Linux system).

To speed things up, you can just leave the soundtrack file in the directory.

Davide Alberani
  • 1,061
  • 1
  • 18
  • 28
  • Thanks for pointing out that I only needed the soundtrack file to speed up this process. I answered the question with the resolution. Let me know if you want this filed as a bug. – Tool Man Jul 06 '15 at 18:26
  • Great! Thanks for pointing this out. No problem, I'll file a bug to remind myself to fix it as soon as possible. – Davide Alberani Jul 12 '15 at 19:20
0

The issue is with the definition of the SNDT_START tag. See the diff below that corrects the soundtrack import issue.

diff my-imdbpy2sql.py imdbpy2sql.py
796c796
< SNDT_START = ('SOUNDTRACKS', '=============', '', '', '')
---
> SNDT_START = ('SOUNDTRACKS LIST', '================', '', '', '')
Tool Man
  • 311
  • 4
  • 13