[RELEASE] - Thumbnails Cleaner v1.1.4

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #1
Hi all, another script I hope you like it.

What does
Thumbnails Cleaner allows you to clean the thumbnails folder of your XBMC

How it works
Thumbnails Cleaner works for exclusion. The script read the databases and excludes the images found. No image will be deleted. Once completed, the images will be moved to the destination folder you choose. In case of simulation, the images will be copied.

[Image: thumbnailsCleaner.png]

Check what has been done
You can check what has been done looking the xbmc.log. Every notice of the script starts with [Thumbnails Cleaner].

Sections that will be controlled
Movies
Sets
TV Shows
Seasons
Episodes
Music Videos
Video Genres (movies, tvshows, musicvideos)
Artists
Albums
Songs
Music Genres
Actors (movies, tvshows, episodes)
Addons
All files that are present in the Textures database (no JSON) - You can query textures database to delete fields.

JSON queries in some cases may require a bit of time. Please wait!

Pay attention
The script is for FRODO or later only.
There may be some bugs, and the script may be incomplete, please make a backup of your Thumbnails folder!

If anyone wants make suggestions, I'm here!

Download from GoogleDrive
script.thumbnailscleaner-1.1.4.zip

Download & Install my unofficial XBMC repository
repository.m4x1m.zip

Code:
v1.1.4.
- Icon changed for the script.
- Fixed issues related to the paths of database and thumbnails.

v1.1.3:
- Added a checks on startup to be sure the database settings are correct.
- Removed checks on folder backup, if the user doesn't choose any folder, the script will use a backup folder under its own script folder.

v1.1.2:
- Added script.module.simplejson as dependency but uses internal JSON if python version is >= 2.7.
- Uses Textures.GetTextures if XBMC is Gotham else uses RAW queries.
- Fixed error when try to copy/move a non existent files.
- Minimized access to database during process.
- Fix some minor bugs.

v1.1.1:
- Added ability to stop the script in the final dialog box (request by gitr).
- Bump Python version to be compatible with Gotham.
- Moved from the old XML language system to the new .PO strings language system. Translations are welcome.
- Minor bugs fixed.

v1.1.0:
- Fixed bug related to the query for delete textures.

v1.0.9:
- Added ability to disable the check for the various sections.
- Improved and cleaned the code.
- Fixed some other little bugs.

v1.0.8:
- Added ability to select multiple fields when doing a query to database for delete.
- Added ability to select multiple fields for keep textures before the cleaning process will be completed.
- In the configuration settings now you can add a pattern for exclude some strings from the process.
- Fixed some other important bugs.

v1.0.7:
- This is a beta version. Full changelog available in the next release.

v1.0.6:
- Fixed some unicode strings.

v1.0.5:
- Rewritten for using JSON RPC.
- Improved the check on destination folder.

v1.0.4:
- Fixed all problems related to mysql database (for real).
- Added check for music video posters.
- Fixed issue when moving files in destination folder that already exist.

v1.0.3:
- Fixed issue related to the Texture table in mysql.

v1.0.2:
- Empties destination folder before copy/move the new files.

v1.0.1:
- Fixed a typo that prevented to connect to the database.

v1.0.0:
- First script release.

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
(This post was last modified: 2014-12-13 18:46 by m4x1m.)
find quote
Raytestrak Offline
Donor
Posts: 356
Joined: Sep 2011
Reputation: 3
Post: #2
Awesome! Gonna try this when I get home.

XBMCbuntu on an Intel NUC (DC3217IYE). Onkyo NR-717. Canton Movie CD-1000. LG 42LM760S

If it ain't broke: break it, fix it, repeat
find quote
DaDuck Offline
Junior Member
Posts: 7
Joined: Feb 2013
Reputation: 0
Post: #3
Thanks but i cant get it to work at all just freezes when i try to clean

http://pastebin.com/E2ZmY3A5

Don't know if that log helps
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #4
(2013-03-14 14:27)DaDuck Wrote:  Thanks but i cant get it to work at all just freezes when i try to clean

http://pastebin.com/E2ZmY3A5

Don't know if that log helps

My fault. Try this.

Download
script.thumbnailscleaner-1.0.1.zip

Code:
v1.0.1:
- Fixed a typo that prevented to connect to the database.

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #5
(2013-03-14 14:27)DaDuck Wrote:  Thanks but i cant get it to work at all just freezes when i try to clean

http://pastebin.com/E2ZmY3A5

Don't know if that log helps

Today, I'm a bit stoned! Angry

Download
script.thumbnailscleaner-1.0.2.zip

Code:
v1.0.2:
- Empties destination folder before copy/move the new files.

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
find quote
SpaceMonkey Offline
Posting Freak
Posts: 1,162
Joined: Aug 2008
Reputation: 24
Location: Finland
Post: #6
Does not seem to work with mysql?

Code:
17:56:37 T:4578516992   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ImportError'>
                                            Error Contents: No module named mysql.connector
                                            Traceback (most recent call last):
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/gui.py", line 50, in onInit
                                                Cleaner( self ).getAllInfo()
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/cleaner.py", line 98, in getAllInfo
                                                match = RawXbmcDb.query( "SELECT cachedurl, lasthashcheck FROM texture", dbTextures )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 9, in query
                                                RawXbmcDb_Connect = findXbmcDb( name )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 51, in findXbmcDb
                                                import mysql.connector
                                            ImportError: No module named mysql.connector
                                            -->End of Python script error report<--
17:56:37 T:4497084416   DEBUG: NEWADDON PythonCallbackHandler construction with PyThreadState 0x10be95f20
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #7
(2013-03-14 17:47)toiva Wrote:  Does not seem to work with mysql?

Code:
17:56:37 T:4578516992   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ImportError'>
                                            Error Contents: No module named mysql.connector
                                            Traceback (most recent call last):
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/gui.py", line 50, in onInit
                                                Cleaner( self ).getAllInfo()
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/cleaner.py", line 98, in getAllInfo
                                                match = RawXbmcDb.query( "SELECT cachedurl, lasthashcheck FROM texture", dbTextures )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 9, in query
                                                RawXbmcDb_Connect = findXbmcDb( name )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 51, in findXbmcDb
                                                import mysql.connector
                                            ImportError: No module named mysql.connector
                                            -->End of Python script error report<--
17:56:37 T:4497084416   DEBUG: NEWADDON PythonCallbackHandler construction with PyThreadState 0x10be95f20

Strange:
<import addon="script.module.myconnpy" version="0.3.2"/>

Get here (manual install):
http://ftp.heanet.ie/mirrors/xbmc/addons....myconnpy/

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
(This post was last modified: 2013-03-14 18:22 by m4x1m.)
find quote
SpaceMonkey Offline
Posting Freak
Posts: 1,162
Joined: Aug 2008
Reputation: 24
Location: Finland
Post: #8
Next error. All the databases exist, and the version numbers match.

Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'mysql.connector.errors.ProgrammingError'>
                                            Error Contents: 1049: Unknown database 'Textures13'
(This post was last modified: 2013-03-14 19:30 by SpaceMonkey.)
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #9
(2013-03-14 19:29)toiva Wrote:  Next error. All the databases exist, and the version numbers match.

Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'mysql.connector.errors.ProgrammingError'>
                                            Error Contents: 1049: Unknown database 'Textures13'

Ok, this was my doubt!

The textures database is in mysql or sqlite?

Try to replace dbutils.py with this one dbutils.py

USER/.xbmc/addons/script.thumbnailscleaner/resources/lib/

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
(This post was last modified: 2013-03-14 20:30 by m4x1m.)
find quote
DaDuck Offline
Junior Member
Posts: 7
Joined: Feb 2013
Reputation: 0
Post: #10

(2013-03-14 15:35)m4x1m Wrote:  
(2013-03-14 14:27)DaDuck Wrote:  Thanks but i cant get it to work at all just freezes when i try to clean

http://pastebin.com/E2ZmY3A5

Don't know if that log helps

Today, I'm a bit stoned! Angry

Download
script.thumbnailscleaner-1.0.2.zip

Code:
v1.0.2:
- Empties destination folder before copy/move the new files.


Still same error =/
(This post was last modified: 2013-03-14 20:18 by DaDuck.)
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #11
(2013-03-14 20:16)DaDuck Wrote:  
(2013-03-14 15:35)m4x1m Wrote:  
(2013-03-14 14:27)DaDuck Wrote:  Thanks but i cant get it to work at all just freezes when i try to clean

http://pastebin.com/E2ZmY3A5

Don't know if that log helps

Today, I'm a bit stoned! Angry

Download
script.thumbnailscleaner-1.0.2.zip

Code:
v1.0.2:
- Empties destination folder before copy/move the new files.


Still same error =/

Please, check the contents of your advancedsettings.xml

Code:
Error Contents: "junk" after document element: line 34, column 19

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
find quote
SpaceMonkey Offline
Posting Freak
Posts: 1,162
Joined: Aug 2008
Reputation: 24
Location: Finland
Post: #12
(2013-03-14 19:59)m4x1m Wrote:  
(2013-03-14 19:29)toiva Wrote:  Next error. All the databases exist, and the version numbers match.

Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'mysql.connector.errors.ProgrammingError'>
                                            Error Contents: 1049: Unknown database 'Textures13'

Ok, this was my doubt!

The textures database is in mysql or sqlite?

Try to replace dbutils.py with this one dbutils.py

USER/.xbmc/addons/script.thumbnailscleaner/resources/lib/

Local sqlite, i was not even aware you could have it in mysql?

New error with the replaced dbutils.py Big Grin

Code:
20:53:38 T:4543098880   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'mysql.connector.errors.ProgrammingError'>
                                            Error Contents: 1049: Unknown database 'MyVideos75'
                                            Traceback (most recent call last):
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/gui.py", line 155, in onClick
                                                elif controlId == self.idSimulate: Cleaner( self ).doClean(True)
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/cleaner.py", line 189, in doClean
                                                self.getAllInfo()
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/cleaner.py", line 104, in getAllInfo
                                                match = RawXbmcDb.query( "SELECT url FROM art WHERE media_type='movie' AND type='poster'", dbVideos )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 9, in query
                                                RawXbmcDb_Connect = findXbmcDb( name )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.thumbnailscleaner/resources/lib/dbutils.py", line 53, in findXbmcDb
                                                return mysql.connector.Connect( host = str( host ), port = int( port ), database = str( name ), user = str( user ), password = str( pswd ) )
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/__init__.py", line 45, in Connect
                                                return MySQLConnection(*args, **kwargs)
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/connection.py", line 366, in __init__
                                                self.connect(*args, **kwargs)
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/connection.py", line 411, in connect
                                                ssl=(ssl_ca, ssl_cert, ssl_key))
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/connection.py", line 449, in _open_connection
                                                self._charset)
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/protocol.py", line 347, in do_auth
                                                buf = self.conn.recv()
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/connection.py", line 179, in recv_plain
                                                errors.raise_error(buf)
                                              File "/Users/anssi/Library/Application Support/XBMC/addons/script.module.myconnpy/lib/mysql/connector/errors.py", line 82, in raise_error
                                                raise get_mysql_exception(errno,errmsg)
                                            ProgrammingError: 1049: Unknown database 'MyVideos75'
                                            -->End of Python script error report<--
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #13
(2013-03-14 19:29)toiva Wrote:  Local sqlite, i was not even aware you could have it in mysql?

No, the problem is that I don't have a mysql db.

Download the v1.0.3

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
(This post was last modified: 2013-03-14 21:27 by m4x1m.)
find quote
SpaceMonkey Offline
Posting Freak
Posts: 1,162
Joined: Aug 2008
Reputation: 24
Location: Finland
Post: #14
1.0.3 with included dbutils

Code:
Error Type: <class 'mysql.connector.errors.ProgrammingError'>
Error Contents: 1049: Unknown database 'MyVideos75'

Sorry, i left out quite a important bit of information, the database name is not MyVideos75 if the db name if specified in advancedsettings.xml like this, but xbmc_video75.

Code:
<videodatabase>
        <type>mysql</type>
        <host>UnRAID</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_video</name>
    </videodatabase>

    <musicdatabase>
        <type>mysql</type>
        <host>UnRAID</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_music</name>
    </musicdatabase>
(This post was last modified: 2013-03-14 21:48 by SpaceMonkey.)
find quote
m4x1m Offline
Fan
Posts: 317
Joined: Mar 2011
Reputation: 23
Location: Italy
Post: #15
(2013-03-14 21:45)toiva Wrote:  1.0.3 with included dbutils

Code:
Error Type: <class 'mysql.connector.errors.ProgrammingError'>
Error Contents: 1049: Unknown database 'MyVideos75'

Sorry, i left out quite a important bit of information, the database name is not MyVideos75 if the db name if specified in advancedsettings.xml like this, but xbmc_video75.

Code:
<videodatabase>
        <type>mysql</type>
        <host>UnRAID</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_video</name>
    </videodatabase>

    <musicdatabase>
        <type>mysql</type>
        <host>UnRAID</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_music</name>
    </musicdatabase>

Eh eh, this is most important! I've used the default names!

Ok, tell me if the real name of database is xbmc_video or xbmc_video75!

LG M227WD - ASUS S1-AT5NM10E - LOGITECH HARMONY 300i - MINI KEYBOARD USB
Running Ubuntu Precise 12.04.04 - FRODO 12.03 - Transparency!
Movies: 996 - TV Show: 98 - Albums: 1161

My Script: Rating Update - Thumbnails Cleaner
(This post was last modified: 2013-03-14 22:30 by m4x1m.)
find quote
Post Reply