[RELEASE] IMDB Ratings for Movies

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
dvbtjunkie Offline
Junior Member
Posts: 10
Joined: Apr 2010
Reputation: 0
Location: Germany
Post: #76
(2013-06-21 15:07)shedrock Wrote:  Here is the log:
http://xbmclogs.com/show.php?id=30288

Its the same Error, just edit the line in default.py and smile Big Grin

(2013-06-18 23:30)dvbtjunkie Wrote:  
(2013-06-18 08:58)Jandalf Wrote:  
(2013-06-18 00:05)dvbtjunkie Wrote:  @ cosmicr
Any ideas to fix the Problem?

change this line in default.py:
Code:
pDialog.update(percent,_('beginning_update'),movie['label'],_('rating')+rating)
to
Code:
pDialog.update(int(percent),_('beginning_update'),movie['label'],_('rating')+rating)

@ Jandalf
OMG, only a convert to Integer.... Thx a lot

Now it works fine... Big Grin

Big Grin lol

@Jandalf not only in openelec, i use the normal xbmcbuntu,
it seems like a linux issue
(This post was last modified: 2013-06-21 23:12 by dvbtjunkie.)
find quote
shedrock Offline
Senior Member
Posts: 296
Joined: Oct 2012
Reputation: 7
Post: #77
I have approx. 1200 movies

Thank you, it works great.

[Image: all-banner.jpg]
(This post was last modified: 2013-06-21 23:14 by shedrock.)
find quote
shedrock Offline
Senior Member
Posts: 296
Joined: Oct 2012
Reputation: 7
Post: #78
Is there any way I can add a command to a remote button or even in the context menu of the skin that I am using so that I can update the IMDB ratings for each movie separately?

The reason I ask is because it takes so long to go through my entire library.

Thanks
Shedrock

[Image: all-banner.jpg]
find quote
Jandalf Offline
Senior Member
Posts: 126
Joined: May 2013
Reputation: 3
Location: Germany
Post: #79
(2013-06-22 14:06)shedrock Wrote:  Is there any way I can add a command to a remote button or even in the context menu of the skin that I am using so that I can update the IMDB ratings for each movie separately?

The reason I ask is because it takes so long to go through my entire library.

Thanks
Shedrock

as far as I know it is not possible to start an addon by keyboard input. But this addon: http://forum.xbmc.org/showthread.php?tid=107331 can run in background, maybe this is an option for you.
find quote
jayleekay Offline
Member
Posts: 54
Joined: Mar 2011
Reputation: 0
Post: #80
Deleted
(This post was last modified: 2013-06-23 20:30 by jayleekay.)
find quote
jayleekay Offline
Member
Posts: 54
Joined: Mar 2011
Reputation: 0
Post: #81
(2013-06-18 08:58)Jandalf Wrote:  
(2013-06-18 00:05)dvbtjunkie Wrote:  @ cosmicr
Any ideas to fix the Problem?

change this line in default.py:
Code:
pDialog.update(percent,_('beginning_update'),movie['label'],_('rating')+rating)
to
Code:
pDialog.update(int(percent),_('beginning_update'),movie['label'],_('rating')+rating)
find quote
shedrock Offline
Senior Member
Posts: 296
Joined: Oct 2012
Reputation: 7
Post: #82
(2013-06-23 19:59)Jandalf Wrote:  
(2013-06-22 14:06)shedrock Wrote:  Is there any way I can add a command to a remote button or even in the context menu of the skin that I am using so that I can update the IMDB ratings for each movie separately?

The reason I ask is because it takes so long to go through my entire library.

Thanks
Shedrock

as far as I know it is not possible to start an addon by keyboard input. But this addon: http://forum.xbmc.org/showthread.php?tid=107331 can run in background, maybe this is an option for you.



Thanks

[Image: all-banner.jpg]
find quote
SNA0815 Offline
Junior Member
Posts: 5
Joined: Jul 2013
Reputation: 0
Post: #83
Can anyone help catching this socket timeout error?

Code:
18:03:40 T:2883466304   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'socket.timeout'>
                                            Error Contents: timed out
                                            Traceback (most recent call last):
                                              File "/home/pi/.xbmc/addons/script.imdbratings/default.py", line 132, in <module>
                                                main()
                                              File "/home/pi/.xbmc/addons/script.imdbratings/default.py", line 104, in main
                                                imdbdata = simplejson.load(urllib2.urlopen(url))
                                              File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
                                                return _opener.open(url, data, timeout)
                                              File "/usr/lib/python2.7/urllib2.py", line 401, in open
                                                response = self._open(req, data)
                                              File "/usr/lib/python2.7/urllib2.py", line 419, in _open
                                                '_open', req)
                                              File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
                                                result = func(*args)
                                              File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
                                                return self.do_open(httplib.HTTPConnection, req)
                                              File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
                                                r = h.getresponse(buffering=True)
                                              File "/usr/lib/python2.7/httplib.py", line 1034, in getresponse
                                                response.begin()
                                              File "/usr/lib/python2.7/httplib.py", line 407, in begin
                                                version, status, reason = self._read_status()
                                              File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
                                                line = self.fp.readline()
                                              File "/usr/lib/python2.7/socket.py", line 447, in readline
                                                data = self._sock.recv(self._rbufsize)
                                            timeout: timed out
                                            -->End of Python script error report<--
find quote
Jandalf Offline
Senior Member
Posts: 126
Joined: May 2013
Reputation: 3
Location: Germany
Post: #84
(2013-07-06 18:06)SNA0815 Wrote:  Can anyone help catching this socket timeout error?

Code:
18:03:40 T:2883466304   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'socket.timeout'>
                                            Error Contents: timed out
                                            Traceback (most recent call last):
                                              File "/home/pi/.xbmc/addons/script.imdbratings/default.py", line 132, in <module>
                                                main()
                                              File "/home/pi/.xbmc/addons/script.imdbratings/default.py", line 104, in main
                                                imdbdata = simplejson.load(urllib2.urlopen(url))
                                              File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
                                                return _opener.open(url, data, timeout)
                                              File "/usr/lib/python2.7/urllib2.py", line 401, in open
                                                response = self._open(req, data)
                                              File "/usr/lib/python2.7/urllib2.py", line 419, in _open
                                                '_open', req)
                                              File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
                                                result = func(*args)
                                              File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
                                                return self.do_open(httplib.HTTPConnection, req)
                                              File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
                                                r = h.getresponse(buffering=True)
                                              File "/usr/lib/python2.7/httplib.py", line 1034, in getresponse
                                                response.begin()
                                              File "/usr/lib/python2.7/httplib.py", line 407, in begin
                                                version, status, reason = self._read_status()
                                              File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
                                                line = self.fp.readline()
                                              File "/usr/lib/python2.7/socket.py", line 447, in readline
                                                data = self._sock.recv(self._rbufsize)
                                            timeout: timed out
                                            -->End of Python script error report<--

surround it with:
Code:
try:
            response = imdbdata = simplejson.load(urllib2.urlopen(url))
except:
            self.__error = True
or try my add-on (->sig)
(This post was last modified: 2013-07-06 18:43 by Jandalf.)
find quote
collaed Offline
Junior Member
Posts: 1
Joined: Dec 2013
Reputation: 0
Post: #85
Hi,

I'm using OpenELEC based on XBMC 12.2, I had to change a returned type (cast) to be able to run.
On line 115:
#lognotify the user
percent = (float(numupdated)/len(movies))*100
pDialog.update(percent,_('beginning_update'),movie['label'],_('rating')+rating)

I had to change percent = to an int.
percent = (int(numupdated)/len(movies))*100

Some specific titles are causing issues, but at the moment, some of them can be traced to issues within the JSON passed by OMDB. I understand verbosity can be an issue, but for those, I had to put in
lognotify(movie['label'] + " is about to be checked http://www.omdbapi.com/?i=" + movie['imdbnumber'])
just at line 98 before the test of the imdb number.

Kind regards,

ECB
find quote
matthuisman Offline
Skilled Python Coder
Posts: 601
Joined: Sep 2006
Reputation: 5
Location: Chch, New Zealand
Post: #86
Hi,

Very nice and handy script.
I have made a few updates that I think improve the script a bit

1) Instead of storing the last movie ID, it now stores a list of completed movie ID's
- This allows it to fail on movies and still retry them the next time the script runs (using the last id would skip these movies)

2) Dialog now shows the current movie / total (Updating rating for movie: 23/506)

3) Start dialog now always asks you to confirm to proceed with NUMBER of movies ("You are about to update 23 movies. Proceed?")

4) If the script fails on the movie, the dialog will update and display "Error: Skipping" for 2 seconds (it will also LOG the movie name)

5) Script can now handle a URL timeout to the API (instead of failing) - this will cause the above error, as will no IMDB rating being returned from API

6) Entire movie loop into TRY / EXCEPT block just in case of any unaccepted errors. The completed ID's are written after this block to ensure completed movies are always recorded.

7) Updated script version to 2.1

I have uploaded it HERE for anyone who is interested Smile
(Install the same way as the original (install from ZIP_=))

Thanks,

Matt
(This post was last modified: 2014-01-21 09:23 by matthuisman.)
find quote
cosmicr Offline
Senior Member
Posts: 156
Joined: Oct 2010
Reputation: 1
Location: Australia
Post: #87
great work matt! I really appreciate it, I don't get nearly enough time to work on this or check the forum to support users. I'd love it if you fork my github repo and send a pull request. keeps it nice and tidy for me Smile

I'll try to update the first post sometime soon with your update.
find quote
wgstarks Offline
Posting Freak
Posts: 1,304
Joined: Jun 2013
Reputation: 9
Location: North Carolina, USA
Post: #88
(2014-01-21 09:17)matthuisman Wrote:  Hi,

Very nice and handy script.
I have made a few updates that I think improve the script a bit

1) Instead of storing the last movie ID, it now stores a list of completed movie ID's
- This allows it to fail on movies and still retry them the next time the script runs (using the last id would skip these movies)

2) Dialog now shows the current movie / total (Updating rating for movie: 23/506)

3) Start dialog now always asks you to confirm to proceed with NUMBER of movies ("You are about to update 23 movies. Proceed?")

4) If the script fails on the movie, the dialog will update and display "Error: Skipping" for 2 seconds (it will also LOG the movie name)

5) Script can now handle a URL timeout to the API (instead of failing) - this will cause the above error, as will no IMDB rating being returned from API

6) Entire movie loop into TRY / EXCEPT block just in case of any unaccepted errors. The completed ID's are written after this block to ensure completed movies are always recorded.

7) Updated script version to 2.1

I have uploaded it HERE for anyone who is interested Smile
(Install the same way as the original (install from ZIP_=))

Thanks,

Matt

Very nice. I like the way the script skips problem videos. I notice an oddity though. The script updated all videos starting with "1" thru the letter "D" then skipped to "M" thru "Z" then went back and updated the video ratings for the ones that had been skipped. Does the script order the scan based on old vs new maybe? I've been adding local trailers for all my videos because of problems streaming trailers from YouTube and it looks like all the videos that were skipped have just been "Refreshed" within the past week. Just an oddity that made me curious. I saved a debug log of this although I don't really think it's a bug since every video did get updated except one that was skipped to avoid the script failure.

Has this script been added to the official repo yet? Just wondering if I need to keep an eye out for updates.

[Image: all-thin-banner.jpg]
MacMini5,2 HTPC (Gotham 13.2/Aeon Nox 5.1.5/MacOSX 10.8.5)/Onkyo TXNR609/Panny65VT30
find quote
matthuisman Offline
Skilled Python Coder
Posts: 601
Joined: Sep 2006
Reputation: 5
Location: Chch, New Zealand
Post: #89
Hi,

I'm pretty sure the API returns the list in order from newest to oldest scanned in?
Code:
command='{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties" : ["rating", "imdbnumber", "votes", "top250", "year"] }, "id": 1}'
So, your newest movies scan in first.

I have just updated it so the list is reversed.
It makes more sense to start with older scanned in movies (older IMDB rating or using older scraper settings when scanned in)

DOWNLOAD LINK

Thanks,

Matt
find quote
wgstarks Offline
Posting Freak
Posts: 1,304
Joined: Jun 2013
Reputation: 9
Location: North Carolina, USA
Post: #90
(2014-01-22 09:59)matthuisman Wrote:  Hi,

I'm pretty sure the API returns the list in order from newest to oldest scanned in?
Code:
command='{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties" : ["rating", "imdbnumber", "votes", "top250", "year"] }, "id": 1}'
So, your newest movies scan in first.

I have just updated it so the list is reversed.
It makes more sense to start with older scanned in movies (older IMDB rating or using older scraper settings when scanned in)

DOWNLOAD LINK

Thanks,

Matt

Thanks for the reply. Actually my newest movies scanned last with vs 2.1. Sort of. I have been doing "batch" refreshes to add local trailers to my db for the past several weeks. Remove the video from the db, clean, re-add the video folder with trailer, update db. Started with "A" and have worked thru "L" so far (slow process Smile). The scan started with videos that were added to the db perhaps a little more than a week ago then scanned the oldest ones and at the very end scanned the most recent (less than one week) entries.

This to me isn't really a big deal. I scan my entire library so the order doesn't really make much difference. The ability to bypass problem videos that were previously resulting in script failure is a major improvement. Just thought I'd provide a little feedback.

If you're interested in feature requests a automated scheduler would be nice. Monthly scans or something along that line.

[Image: all-thin-banner.jpg]
MacMini5,2 HTPC (Gotham 13.2/Aeon Nox 5.1.5/MacOSX 10.8.5)/Onkyo TXNR609/Panny65VT30
find quote
Post Reply