mysql missing soundtrack information after running

2019-09-16 19:51发布

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.

2条回答
欢心
2楼-- · 2019-09-16 20:18

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', '================', '', '', '')
查看更多
你好瞎i
3楼-- · 2019-09-16 20:29

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.

查看更多
登录 后发表回答