mysql 在运行 imdbpy2sql.py 后丢失配乐信息 [英] mysql missing soundtrack information after running imdbpy2sql.py
问题描述
我正在参考这个 stackoverflow 答案.
I am referencing this stackoverflow answer.
https://stackoverflow.com/a/20948609/4891914
我无法对此发表评论,因为我的声誉未超过 50.我使用了确切的代码,但出现此错误:
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'
我也试过这个变种:
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
它打印无".当 imdbpy2sql.py 运行时,文件 soundtracks.list.gz 确实存在于所有其他 imdb 文件所在的目录中.我确实确认在 imdb.com 上确实存在该电影的配乐.
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
任何帮助将不胜感激.
UPDATE MySQL 查询 info_type 和 movie_info 表;
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
所以问题可能出在 imdbpy2sql.py 脚本上.如前所述,在调试此问题方面的任何帮助将不胜感激.
So the issue is probably with the imdbpy2sql.py script. As stated before any help in debugging this issue will be greatly appreciated.
推荐答案
问题在于 SNDT_START
标签的定义.请参阅下面更正音轨导入问题的差异.
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', '================', '', '', '')
这篇关于mysql 在运行 imdbpy2sql.py 后丢失配乐信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!