Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
[RELEASE] IMDB Ratings for Movies
#1
This is an addon script inspired by the php supplementary tool written by XBL

The original thread for that script can be found here: http://forum.xbmc.org/showthread.php?tid=72094

This script behaves in much the same way. It goes through your library and updates each movie with the rating from the IMDB.

If you're not happy with this script (let me know!), there's another great script written by m4x1m which does the same thing. You can find it here: http://forum.xbmc.org/showthread.php?tid=107331

Screenshot:
Image

January 26, 2011 - Version 1.0
Original Release

Version 1.1
Ignore non-ascii characters.

February 9, 2012 - Version 1.2
Fixed upload links, fixed scraper and other minor fixes.

February 12, 2012 - Version 1.3
Added MySQL Support!
Fixed problem with top 250 regular expression.

May 26, 2013 - Version 2.0 Download the Addon: https://www.dropbox.com/s/jroy9e1xonw1no...gs-2.0.zip
Complete re-write, now uses JSON-RCP API. Which means it doesn't matter if you use SQLite or MySQL.
Now uses OMDBAPI instead of IMDB.
Can search for movie even if the database doesn't have an imdb id.
Better progress meter, and other code cleanups.

As always, you can find the code in my github page: https://github.com/cosmicr/IMDB-Ratings-for-Movies

Installation:
1. In XBMC, go to System->Addons->Install from ZIP file
2. Select the file you downloaded
3. Script is installed, found in Programs
4. Default settings should work for most.

Notes:
- There's not a great deal of error checking, but I have tried to be verbose. If something goes wrong, please let me know, but I won't be held responsible.
- The addon doesn't 100% comply with XMBC's requirements to go into the repository, but I am working on that and as soon as it does I'll request to have it put up there.

Todo:
- Change location of lastid.dat file
- Run the addon periodically (like the library updater addon)
- Ratings for TV Show episodes too (where should I get them from?)
- Put it on an XBMC Addon repository
- If you would like a feature added, let me know

If you come across any bugs, or other problems, please post your debug log and let me know!

I'm not the greatest coder, but at least it works!
Reply
#2
If you find any bugs etc, be sure to include your debug log!
Reply
#3
I am running it now but for TV I would scrape http://thetvdb.com/ for info.

How exactly does this update? Overwrite the rating in the nfo? or something else?
Reply
#4
All it does is get the imdb id from the database and look it up on imdb. Then it gets the new rating and updates the database with it.

There's no nfo updating (sorry).

The current scraper gets ratings from thetvdb for episodes, I was looking for a suggestion to a better site.
Reply
#5
well I have run this 6 times so far and my last error was this
Code:
18:24:20 T:3536 M:4294967295  NOTICE: IMDB Rating Script: Opening http://www.imdb.com/title/tt0110413
18:24:21 T:3536 M:4294967295   ERROR: Error Type: exceptions.UnicodeEncodeError
18:24:21 T:3536 M:4294967295   ERROR: Error Contents: 'ascii' codec can't encode character u'\xe9' in position 21: ordinal not in range(128)
18:24:21 T:3536 M:4294967295   ERROR: Traceback (most recent call last):
                                              File "C:\Users\AppData\Roaming\XBMC\addons\script.imdbratings\default.py", line 112, in ?
                                                print d_notify + title[j] + "(" + str(lid[j]) + ")" + " rating: " + str(rating[0]) + "/10"
                                              File "<string>", line 4, in write
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 21: ordinal not in range(128)
Reply
#6
Harro Wrote:well I have run this 6 times so far and my last error was this
Code:
18:24:20 T:3536 M:4294967295  NOTICE: IMDB Rating Script: Opening http://www.imdb.com/title/tt0110413
18:24:21 T:3536 M:4294967295   ERROR: Error Type: exceptions.UnicodeEncodeError
18:24:21 T:3536 M:4294967295   ERROR: Error Contents: 'ascii' codec can't encode character u'\xe9' in position 21: ordinal not in range(128)
18:24:21 T:3536 M:4294967295   ERROR: Traceback (most recent call last):
                                              File "C:\Users\AppData\Roaming\XBMC\addons\script.imdbratings\default.py", line 112, in ?
                                                print d_notify + title[j] + "(" + str(lid[j]) + ")" + " rating: " + str(rating[0]) + "/10"
                                              File "<string>", line 4, in write
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 21: ordinal not in range(128)

Hmmm the e in Leon is stuffing it up, I'll look into it.
Reply
#7
I've modified it to ignore non-ascii characters, updated the first post with v1.1, give it a try.
Reply
#8
does this support mysql databases too? I get:

Code:
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: Database backed up to /home/xbmc/.xbmc/addons/script.imdbratings/../../userdata/Database/MyVideos34.db.bak.20110126-0940
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: So far so good!
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: lastid.dat doesnt exist. This is normal on first run.
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: Getting ratings for all movies in library...
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: Nothing to update
09:40:48 T:2350947184 M:1913212928  NOTICE: IMDB Rating Script: Ratings script complete.

*Edit* to say - looked at the source and only supports sqlite at the moment - any plans to add mysql support later?
Reply
#9
Please add MySQL to your todo list, pls pls pls Big Grin
Reply
#10
cosmicr;

Thank you very much for this addon! I'm really looking forward to using it.
I'm on windows7 though!
Reply
#11
Scidd0w Wrote:cosmicr;

Thank you very much for this addon! I'm really looking forward to using it.
I'm on windows7 though!

give it a try - it may work.

about SQL, well I'm not very good at SQL, I copied all the queries from the php code. I'm not sure about using mysql instead of sqlite. I suppose the script would first have to check what the database type is. Or are the two types compatible? I'll look into it, but it may be beyond my capabilities.
Reply
#12
cosmicr Wrote:give it a try - it may work.

I am at work atm, so can't test but I had a quick look over the code and I don't see any major reasons why the plugin wouldn't work on windows/mac (although could have missed something).

It may not find the file paths correctly, but I think that's about it. I will give it a shot tonight.
Reply
#13
I'm also at work atm.
I'll give it a spin when I get home!
Reply
#14
I started messing around with the code to see if I can get a stand-alone version working that connects to the myqsl database instead of using the sqllite stuff - it's been a while since I've done any programming and I've never used python before so it's somewhat slow going!

I was hoping that I could just swap the sqllite apis for mysql ones and everything else would just work but it seems that the database schema's are not the same so I have more to do. I'll try to keep chipping away at it in spare moments (or until someone more competent steps in).

So far I have a Python connecting to the database but get the below error:

Code:
Traceback (most recent call last):
  File "imdb.py", line 85, in <module>
    c.execute('SELECT c09, c00, idMovie FROM movie WHERE idMovie > ?',(lastid,))
  File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 151, in execute
    query = query % db.literal(args)
TypeError: not all arguments converted during string formatting

So looks like I will need to work on the database stuff a bit
Reply
#15
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)
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7

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