2011-08-09, 18:33
Code:
IMPORTANT NOTES:
Hi guys, sorry but consider this project abandoned, I have no more free time to dedicate it.
The repository will be deactivated soon.
If someone want to continue the develop is welcome.
Hi all, this is my first script in python language I hope you like it.
What does
Basically updates the ratings and the number of users who have voted of all your movies/tv shows (no single episodes) from IMDb and also updates the top250 list. Now update also the MPAA ratings.
How it works
Use the IMDbPHP Class locally to retrieve only the actual ratings and top250 without additional data. The KODI database is only updated if necessary. The searches are made through IMDb ID, if in your database doesn't exist IMDb ID the script will skip the movie. For the TV Shows the first launch could ask you to choose the correct TV Show from a list then the IMDb ID will be written in the new ruDatabase (the edit is possible by launch the command from the add-on settings).
To install php-cgi binary see README file or read below
Code:
Linux Ubuntu Users:
- Install php5-cgi "sudo apt-get install php5-cgi".
- For other distributions check the name of package (could be different) and install it.
- Check the correct path (/usr/bin/ by default) in the add-on settings.
OpenELEC: (thanks to zutimmung)
- Install the php-cgi from http://wiki.openelec.tv/index.php?title=RTorrent_Service_Add-on (use the ARM Package for the RPi).
- Move php-cgi executable in a folder that won't be rewritten when updating OpenELEC.
- Make php-cgi executable (e.g. sudo chmod +x php-cgi).
- Check the correct path (/usr/bin/ by default) in the add-on settings.
Windows Users:
- Download php-cgi from http://windows.php.net/download/ choose the last "VC9 x86 Non Thread Safe" zip package.
- Download the x86 version of VisualStudio C++ 2012 from http://www.microsoft.com/en-us/download/details.aspx?id=30679 (need if missing msvcr110.dll)
- Unzip in C:\php5\ or wherever you like.
- Update the correct path in the add-on settings.
Android Users: (thanks to sd26)
- Follow this link http://forum.xda-developers.com/showthread.php?t=1242144 and extract php-cgi for ARM cpu.
- Update the correct path in the add-on settings.
Mac Users:
- Sorry, I don't have a Mac. Search in Google on how to install PHP :-D
- Update the correct path in the add-on settings.
For Skinners:
- To run in Background Mode (adjust settings): <onclick>RunScript(script.ratingupdate)</onclick>
- To run single Movie update: <onclick>RunScript(script.ratingupdate,Single=Movie)</onclick>
- To run single TV Show update: <onclick>RunScript(script.ratingupdate,Single=TVShow)</onclick>
Check what has been done
You can check what has been done looking the kodi.log. Every notice of the script starts with [Rating Update].
Download from GoogleDrive
script.ratingupdate-1.4.3.zip
Download & Install my unofficial KODI repository
repository.m4x1m.zip
Code:
v1.4.3:
- Fixed little bug to show proper context menu.
v1.4.2:
- Updated IMDbPHP Version 2.6.1 to new Version 3.2.0.
- Added update rating option to the context menu (thanks to thedenethor for the hint).
v1.4.1:
- Fixed Kodi freezing during the search of TV Show by the title.
- Updated IMDbPHP Version 2.3.6 to new Version 2.6.1.
- Updated some english string (thanks to oleroc).
- Prevent notify messages output from PHP.
- Renamed XBMC referer to KODI.
v1.4.0:
- Added "Video" filter when searching TV Show by title.
- Formatted number when gets number of voters.
v1.3.9:
- Optimized pattern for better search in the IMDb Top250.
v1.3.8:
- Fixed error when the script try to get the Top250 due to changes in the page by the IMDb staff.
- Updated IMDbPHP Version 2.2.3 to new Version 2.3.6.
- Fixed some minor bugs.
v1.3.7:
- Added a checks on startup to be sure the database settings are correct.
- Updated IMDbPHP Version 2.2.1 to new Version 2.2.3.
v1.3.6:
- Added script.module.simplejson as dependency but uses internal JSON if python version is >= 2.7.
- Fixed error when the script try to get the Top250 due to changes in the page by the IMDb staff.
- Fixed some minor bugs.
v1.3.5:
- If MPAA reason is unavailable, anyway checks if exists a simple MPAA rating (thanks to neurosis13).
- Fixed bug for TV Shows that generated duplicate entries in the ruDatabase (thanks to brotbuexe).
v1.3.4:
- Show always the results when searching by titles even when there's only one title (to prevent erroneous storing).
- Added ability to set TV Show to skip always.
- Floating DelayTime option when run as service to prevent possible issues.
v1.3.3:
- Changed the script icon (thanks to hernandito).
- Included Top250 when the script uses the raw queries exactly as the movies/tvshows (request by ezechiel1917).
- Fixed the notification that showed twice message.
- Avoid that the service runs again in the same weekday, if you restart XBMC.
- When the script runs in the Background Mode (user/service), skip the new TV Shows but anyway add them in the ruDatabase for search by title in a second time (thanks to brotbuexe for the last three changes).
- Two new options for adding the prefix to the MPAA ratings (thanks to boppyman).
- Reorganized addon settings.
v1.3.2:
- Limit the search results of the TV Shows by the titles, only to the TV Series, TV Movies and TV Mini (request by brotbuexe).
- Now you can choose from three options for Background Mode: No - GUI Mode -|User - Runs by the user -|Service - Runs by the week day choose - (request by brotbuexe)
- Fixed issue related to the MPAA reasons that were not stored correctly (thanks to hernandito).
v1.3.1:
- Rewritten and cleaned the script for use the JSON queries.
- Added modding options to store the ratings with the old raw queries method (not in Single Mode). If you want to use this method, that is faster than JSON, you must specify some parameters in the add-on settings to prevent errors caused by an invalid format of the advancedsettings.xml.
- Now the script uses a custom sqlite database to store the IMDb IDs of the TV Shows and others elements instead to use the XBMC database and/or write many file (the script will do again the search for the TV Shows by the titles, I'm sorry).
- Added the option to retrieve the MPAA ratings - by country - with or without the reasons (the reasons are available only for the movies and for USA country). (request by ShadowTek)
- Added the ability to view directly in the XBMC the missing Top250 after update. (request by PatrickBateman)
- Moved in the add-on settings the management of the IMDb IDs stored for the TV Shows.
- Added the option to run the script in background mode (no progress, no questions, only notifications).
- Changed a little bit the GUI (new background and icons).
- Due to many strings changed and for the passage from the old XML system to the new .PO strings system, the old translations (german, portuguese) were removed. New translations are welcome.
- Definitely fixed the issue about whitespace in path for Windows users (I hope).
- Updated IMDbPHP Version 2.1.6 to new Version 2.2.1.
v1.3.0:
- Fixed error when the script try to get the Top250 due to changes in the page by the IMDb staff.
v1.2.9:
- Added Portuguese (Brazil) language. Thanks to Wanilton.
- Little cleanup code.
v1.2.8:
- Improved unicode characters views (I hope).
- Improved searching of TV Show by name (if no result was found, opens keyboard. ESC for skip).
- Print in the XBMC log also movies and tv shows that are already updated.
- Fixed some minor bugs.
v1.2.7:
- Fixed unicode error when scraping a TV Shows.
v1.2.6:
- Updated IMDbPHP Version 2.1.4 to new Version 2.1.6.
v1.2.5:
- Fixed issue for compatibility with Frodo. For mySql users please pay attention, now you must specify in configuration settings, the number of database version!
- Updated IMDbPHP Version 2.1.2 to new Version 2.1.4.
- Others minor bugs fixed.
v1.2.4:
- Fixed error in dbutils.py that prevented to connect to mysql database.
v1.2.3:
- Added positions with leading zeros and year of the movies to the exported file.
v1.2.2:
- Added export of missing movies from the top250 list. Choose the path where to export the txt file in add-on settings otherwise the script will create it in his profile folder.
v1.2.1:
- Added buttons images in media folder for those skins that don't use the default names for these images.
- Added status and latest update date of checks under the icon.
v1.2.0:
- Added German translation. Thanks to solidsatras.
- Fixed typo in english translation.
- Fixed typo in dbutils.py that stopped the script.
v1.1.9:
- Added the ability to scrape a single TV Show (The code for the skinners is in the README file).
- Changed database query method from httpapi to raw for prevent xbmc freezes and added dependency for script.module.myconnpy for mysql users (thanks to ezechiel1917 for the hint).
- Moved 'import json' to 'import simplejson as json' and added dependency for script.module.simplejson to make the script more compatible.
- Solved issue related for double quote in path for the Windows users. This is a temporary hack because if there are whitespaces in the path the script will not work.
- Updated IMDbPHP Version 2.1.0 to new Version 2.1.2.
- Added a simple GUI to control the script by menu (can be disabled).
- Reorganized the resource folder with a different layout.
- Added multilanguage strings (Now is complete). If someone want to add a new language it's welcome.
v1.1.8:
- Added missing quotes to the executable path (To fix issue in MACOS).
v1.1.7:
- Fixed issue related MacOS (I hope, I don't have a MAC to test).
- Added more debug info (visible when debugging is enabled in xbmc: Settings -> System -> Debugging -> Enable debug logging).
v1.1.6:
- Fixed profile folder that doesn't exist on the first launch of the script.
- Fixed error for mysql database that made the script fail.
v1.1.5:
- Added the resume ability when user interrupting the scraping (only for movies and tv shows should also works in background if xbmc crash,
I don't think works when IMDb is unreachable, but not tested).
- Added notify for the actual name of the tv show when you need to choose the correct tv show from the list.
- Added multilanguage strings (Not complete).
- Added in TV Shows number of users who have voted even if the skin doesn't show it.
- Fixed unicode error in TV Shows while scraping.
v1.1.4:
- Fixed problem with damned Windows path (For real).
v1.1.3:
- Reduced the number of queries to the XBMC database.
- Fixed problem with damned Windows path (I hope).
- Fixed some others minor bugs.
v1.1.2:
- Fixed some unicode errors.
- Added more check.
v1.1.1:
- Fixed bug that had blocked access to the IMDb site while scraping a single movie.
- Fixed other some minor bug.
- Improved code and output log.
v1.1.0:
- Changed the method of scraping. IMDbPHP now is run in a local system to prevent the ban of the server IP address by the IMDb staff.
See README file to how to install php-cgi binary.
- Added the ability to scrape ratings of TV Shows (no single episodes, to many differences with thetvdb.com).
The first launch could ask you to choose the correct TV Show from a list then the IMDb ID will be written in the database.
- Changed order of questions: 1. Top250 - 2. Movies - 3. TV Shows
- Fix possible freeze when scraping a single movie. Show result using notifications instead of dialog.ok (I hope)
- Added setting to disable single procedure, confirmation and to hide the progress dialog.
- Added setting to delete IMDb id from TV Shows so you can rescrape and choose another title if the first one chosen was wrong.
v1.0.5:
- Fixed again bug that now was adding -1 to the real position taking from Top250.
v1.0.4:
- Changed IMDb Api, now using imdbphp class (although it'is a little slower but ...) to retrieve only the actual ratings and top250 without additional data.
If anyone knows a good free hosting service, or wants to host the php files (warning: possible increase of traffic), please contact me on the XBMC forum, currently the php class reside on a web space that isn't mine and I can't use it for a long time.
- Improved get_html_source function for rating scraping (now don't stop the process if the api site is unreachable but it will try 5 time then will continue).
- Fixed double log (adding & updated).
- Added the ability to place a button on DialogVideoInfo.xml to retrieve the rating of a single movie.
This is the Run for the skinners: <onclick>RunScript(script.ratingupdate,Single=True)</onclick>
v1.0.3:
- Fixed bug that was adding +1 to the real position taking from Top250.
- Remove fanart image (I don't like anymore).
- Summary result and log information improved.
v1.0.2:
- Fixed print log value for old position for Top250.
- Fixde crash that occurs when api site returns a Parse Error.
v1.0.1:
- Fixed crash that occurs when api site returns N/A.
- Change print log about old and new positions for a clearer understanding.
- Split on two lines print result to fit in gui box.
v1.0.0:
- First script release.