Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7
[RELEASE] IMDB Ratings for Movies
#16
got a bit further with making it work with mysql

Code:
c.execute('SELECT c09, c00, idMovie FROM movie WHERE idMovie > ?',(lastid,))

needs to be changed to

Code:
c.execute('SELECT c09, c00, idMovie FROM movie WHERE idMovie > [b]%s[/b]',(lastid,))

(mysqldb uses %s instead of ? as a placeholder)

Now it runs through all the movies in the db ok but fails when it tries to scrape the first movie with

Code:
Traceback (most recent call last):
  File "imdb.py", line 118, in <module>
    string =  d_notify + title[j] + "(" + str(lid[j]) + ")" + " rating: " + str(rating[0]) + "/10"
IndexError: list index out of range

time for bed so will look at this another time
Reply
#17
atconc Wrote:
Code:
Traceback (most recent call last):
  File "imdb.py", line 118, in <module>
    string =  d_notify + title[j] + "(" + str(lid[j]) + ")" + " rating: " + str(rating[0]) + "/10"
IndexError: list index out of range

time for bed so will look at this another time

that line's not a show stopper, take it out and see if it works. if it does send me the code and I'll integrate it into the addon.

I suppose the user will have to specify their database type (with the default being sqlite). Unless someone knows how to check the type first?
Reply
#18
Scidd0w Wrote:Just tested it and it installs and works under windows7 as well.
I do get an error after a while though. See below fo a copy of the log.
Code:
23:48:30 T:3460 M:1448738816  NOTICE: IMDB Rating Script: Opening http://www.imdb.com/title/tt0211915
23:48:31 T:3460 M:1446731776  NOTICE: IMDB Rating Script: Le Fabuleux Destine d'Amlie Poulain(119) rating: 8.6/10
23:48:31 T:3460 M:1446727680   ERROR: Error Type: exceptions.UnicodeEncodeError
23:48:31 T:3460 M:1446727680   ERROR: Error Contents: 'ascii' codec can't encode character u'\xe9' in position 55: ordinal not in range(128)
23:48:31 T:3460 M:1446727680   ERROR: Traceback (most recent call last):
                                              File "C:\Users\zwartewaal\AppData\Roaming\XBMC\addons\script.imdbratings\default.py", line 114, in ?
                                                xbmc.executebuiltin('xbmc.Notification(IMDB Ratings,'+title[j]+')')
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 55: ordinal not in range(128)

oops, I missed that line, it was the same problem as earlier - non-ascii (utf-8) symbols seem to stuff it up - which most french titles seem to have Smile

I will fix it later.
Reply
#19
cosmicr Wrote:that line's not a show stopper, take it out and see if it works. if it does send me the code and I'll integrate it into the addon.

I suppose the user will have to specify their database type (with the default being sqlite). Unless someone knows how to check the type first?

I think that line builds the IMDB url so is pretty critical? If I comment it out then the run fails because the variable string is undefined. Will keep playing with it...

edit - ignore me - it's just building a like to print in the log
Reply
#20
atconc Wrote:edit - ignore me - it's just building a like to print in the log

It seems like I've got the database part working but the scraping isn't working for me

the str(rating[0]) part is what's throwing the error about the array index being out of bounds which suggests that the rating is never being fetched (I think?)

I put a few print statements in and it looks like I never get into the

if(rating)
if(votes) or
if(top250)

branches of the code so it now just runs through listing out the url for each of the movies like this:

Code:
IMDB Rating Script: 279 Movies to update
IMDB Rating Script: Opening http://www.imdb.com/title/tt0088846
IMDB Rating Script: Opening http://www.imdb.com/title/tt0063350
IMDB Rating Script: Opening http://www.imdb.com/title/tt0248808
IMDB Rating Script: Opening http://www.imdb.com/title/tt0381849

I've not really got any idea how to debug the scraper so I think I'm stuck for now.
Reply
#21
atconc Wrote:
Code:
IMDB Rating Script: 279 Movies to update
IMDB Rating Script: Opening http://www.imdb.com/title/tt0088846
IMDB Rating Script: Opening http://www.imdb.com/title/tt0063350
IMDB Rating Script: Opening http://www.imdb.com/title/tt0248808
IMDB Rating Script: Opening http://www.imdb.com/title/tt0381849

I've not really got any idea how to debug the scraper so I think I'm stuck for now.

well I'm not really sure what's happening there, but if you could send me the full code I'd like to have a look.

I can't really test mySQL since I dont have a database, but perhaps I could debug your code and get it working for you...
Reply
#22
My (very messy) code so far is here, I took out all the xbmc specific stuff so I could run it standalone

http://db.tt/kGyQxZL
Reply
#23
Do you maybe have some time to bring out a fix for the non-ascii char bug I reported earlier? After this fix I can use it for allmy movies without crashing Wink
Reply
#24
hey there I've been a bit busy (working on my other addonsSmile ) but I will post an update in the next few days.
Reply
#25
Super! Thank you for the reply and take your time.
I'll wait (im)patiently.. hehe Wink

[update]
I do not not know if it is allowed to post feature request but I do it anyway. Wink
Could yoy maybe add an option to also show, when the movie is in the IMDB top250, the ranking number in the top250.
Example:
9.0 (top250 #5)
Reply
#26
I'm getting the same issue with non standard characters, its falling over with Brüno for me. I'd love to see this working at the moviedb ratings are pretty useless. I'm surprised this isn't an issue for more people, thanks for the efforts so far.
Reply
#27
cosmicr;
Can you maybe tell me how to fix it? What to change in what lines?
Than I can update it myself and I do not have to bother you again.

Thank you in advance!
Reply
#28
Please make this for Windows as well, this is gold!

It works for me until it gets to a non ascii character, in this case "é" in "Amélie from Montmartre".

If this could be done to run periodically and always keep your movies up to date with the rating, it would be awesome!
Reply
#29
This looks good, any plans to port for ATV2? I'm willing to test it if you wish...
Devices using XBMC
iMac | MacBook | MacBook Air | AppleTV2 | iPad | iPhone4
Image
Image
Reply
#30
DazNoonan Wrote:This looks good, any plans to port for ATV2? I'm willing to test it if you wish...
Any thoughts?
Devices using XBMC
iMac | MacBook | MacBook Air | AppleTV2 | iPad | iPhone4
Image
Image
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
[RELEASE] IMDB Ratings for Movies1