• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 15
[RELEASE] - Thumbnails Cleaner v1.1.4
#1
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, 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

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
Reply
#2
Awesome! Gonna try this when I get home.
CoreElec on a tn95 (s905x). Onkyo NR-656. Canton Movie CD-1000. LG 55B6V.

If it ain't broke: break it, fix it, repeat
Reply
#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
Reply
#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
Reply
#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
Reply
#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
Reply
#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
Reply
#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'
Reply
#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
Reply
#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 =/
Reply
#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
Reply
#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<--
Reply
#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
Reply
#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>
Reply
#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
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 15

Logout Mark Read Team Forum Stats Members Help
[RELEASE] - Thumbnails Cleaner v1.1.44