Kodi Community Forum

Full Version: [RELEASE] Texture Cache Maintenance utility
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2020-02-09, 04:46)Milhouse Wrote: [ -> ]
(2020-02-09, 04:37)Kupo91 Wrote: [ -> ]Do you have an idea what I could do wrong? Its quite a while when I used this tool probably I miss something.

Not really. You could try adding @logfile=tc.log to the command line and then see if it gets as far as writing anything to the logfile - if not then I suspect your Python environment is messed up somehow, try running a trivial Python script and see if that works any better. 

Thanks for your reply. I was able to get it running. But it didn't cache my game library. I use Rom Collection Browser to manage my games and it has a similar view like the video library. Is there a way to cache the posters and screenshots in this view, too?
(2020-02-09, 21:21)Kupo91 Wrote: [ -> ]Is there a way to cache the posters and screenshots in this view, too?

I don't think so.
@Milhouse

Just a quick thanks again:
As a long time LibreELEC+texturecacheutility user i just switched from LibreELEC to Windows for my main system and as hoped this awesome script is the same big help there for all the maintenance stuff which would otherwise be impossible to achieve easily. Thanks!
Hi All

I'm after some help with my texturecache.

I'm trying to recache all info for movies, using the 'c' option give promising output

bash:
jlivin25@kodibuntu:~/bin/myscripts/kodi_texturecache$ /home/jlivin25/bin/myscripts/kodi_texturecache/texturecache.py c movies
Need to cache: [  fanart  ] for movie: (500) Days of Summer                           
Need to cache: [  poster  ] for movie: (500) Days of Summer
Need to cache: [  fanart  ] for movie: *batteries not included
Need to cache: [  poster  ] for movie: *batteries not included
Need to cache: [  fanart  ] for movie: 2 Guns
Need to cache: [  poster  ] for movie: 2 Guns
Need to cache: [  fanart  ] for movie: 9
Need to cache: [  poster  ] for movie: 9
Need to cache: [  fanart  ] for movie: 10 Things I Hate About You
Need to cache: [  poster  ] for movie: 10 Things I Hate About You
Need to cache: [  fanart  ] for movie: 12 Angry Men
Need to cache: [  poster  ] for movie: 12 Angry Men
Need to cache: [  fanart  ] for movie: 13 Assassins
Need to cache: [  poster  ] for movie: 13 Assassins
Need to cache: [  thumb   ] for movie: 13 Assassins
Need to cache: [  fanart  ] for movie: 48 Hrs.
Need to cache: [  poster  ] for movie: 48 Hrs.
Need to cache: [  fanart  ] for movie: 300
Need to cache: [  poster  ] for movie: 300
Need to cache: [  fanart  ] for movie: 1492: Conquest of Paradise
Need to cache: [  poster  ] for movie: 1492: Conquest of Paradise
Need to cache: [  fanart  ] for movie: 2001: A Space Odyssey
Need to cache: [  poster  ] for movie: 2001: A Space Odyssey
Need to cache: [  fanart  ] for movie: A Beautiful Mind
...and many more! (First 100 items shown)

However the end output table suggests otherwise

bash:
Cache pre-load activity summary for "movies":

              |    fanart   |    poster   |  set.fanart |  set.poster |  set.thumb  |    thumb    |    TOTAL    
--------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------
Cached        |      -      |      -      |      -      |      -      |      -      |      -      |      0      
Deleted       |      -      |      -      |      -      |      -      |      -      |      -      |      0      
Duplicate     |      11     |      11     |     165     |     165     |      3      |      -      |     355     
Error         |     747     |     748     |      9      |      9      |      -      |      15     |     1528    
Ignored       |      -      |      -      |      -      |      -      |      -      |      -      |      0      
Skipped       |      21     |      21     |      5      |      6      |      -      |      -      |      53     
Undefined     |      -      |      -      |      -      |      -      |      -      |      -      |      0      
================================================================================================================
TOTAL         |     779     |     780     |     179     |     180     |      3      |      15     |     1936    
Download Time | 00:09:31.66 | 00:09:33.06 | 00:00:07.60 | 00:00:07.63 |      -      | 00:00:12.19 | 00:19:27.59

I created the
Code:
.cfg
 file to go with the script and set log level to verbose.

The returned log is here, can anyone help with any pointers? The aim is not to remove my database as I love where I'm at with the 'newly added', 'resume points' etc etc....

----------------------------------------------------------------------------
TL;DR

Background
Ages ago I used to use Ember Media Manager to create the files necessary for kodi to scrape locally (nfo's, posters, actors, trailers etc). But with my move to Linux that all trailed off. However over several library moves (kodi -> settings -> media export -> move -> import I'd started to get undesirable behavior in my library. eg. scraping not adding new films, missing info etc. So I decided to try to sort this out.

I'm struggling to get the texture cache info held for my media (specifically movies) correct. I share my video library via mysql, the titles, order, resume points etc all pull through to my other devices but the posters & artworks were a mixed bag some correct, some didn't appear.

I read the kodi wiki on the texture cache and realized I don't have the SQL knowledge to resolve directly with the database, so I deleted the Thumbnails folder and texturecache. But no amount of rescanning, cleaning and updating the library from within kodi got the artwork/posters 'back'.

I read further and came across your tool hoped it could help, while I don't yet have the result I want (recache all info) I think I understand some issues better.

If I'm right the SQL database is pointing to artwork stored locally in the SMB media folders so kodi is told to look there for info to display, it cant as these NFO's & artwork were removed some time ago.........

----------------------------------------------------------------------------

@millhouse as an aside an before I forget, just a huge thank you for taking the time to write something like this, appreciate all you do!
(2020-02-26, 00:57)littlejeem Wrote: [ -> ]The returned log is here, can anyone help with any pointers? The aim is not to remove my database as I love where I'm at with the 'newly added', 'resume points' etc etc....
The file you have uploaded is a zip of your configuration file, not your log.

(2020-02-26, 00:57)littlejeem Wrote: [ -> ]If I'm right the SQL database is pointing to artwork stored locally in the SMB media folders so kodi is told to look there for info to display, it cant as these NFO's & artwork were removed some time ago.........
I should be able to tell you once you upload the log file... Smile

You should also check your kodi.log for errors as it's Kodi that is failing to cache the artwork and should be logging details that may indicate what the problem is (the script only instructs Kodi to cache a particular artwork item and receives either a success or failure message - it usually has no idea why an artwork item can't be cached).
(2020-02-26, 01:39)Milhouse Wrote: [ -> ]
(2020-02-26, 00:57)littlejeem Wrote: [ -> ]The returned log is here, can anyone help with any pointers? The aim is not to remove my database as I love where I'm at with the 'newly added', 'resume points' etc etc....
What an idiot, corrected link is now here
(2020-02-26, 01:39)Milhouse Wrote: [ -> ]You should also check your kodi.log for errors as it's Kodi that is failing to cache the artwork and should be logging details that may indicate what the problem is (the script only instructs Kodi to cache a particular artwork item and receives either a success or failure message - it usually has no idea why an artwork item can't be cached). 

I'll put kodi into debug and re-run the utility, see what I can spot, thanks for the tip......I'll feed back.
Check that the Kodi client has read access to the Samba shares:

text:

smb://192.168.0.2/SD Films
smb://192.168.0.2/HD Films

My guess is that it does not, or there is no longer any artwork present/available on the shares to be cached, ie.

text:

smb://192.168.0.2/SD Films/batteries not included (1987)/batteries not included.DVD-fanart.jpg
smb://192.168.0.2/HD Films/2 Guns (2013)/2 Guns (2013)-fanart.jpg

The kodi log should tell you what kind of error is occurring when accessing these smb:// paths. Fix the Kodi image access issue and the caching should then work.
(2020-02-26, 14:38)Milhouse Wrote: [ -> ]Check that the Kodi client has read access to the Samba shares:

text:

smb://192.168.0.2/SD Films
smb://192.168.0.2/HD Films

My guess is that it does not, or there is no longer any artwork present/available on the shares to be cached, ie.

text:

smb://192.168.0.2/SD Films/batteries not included (1987)/batteries not included.DVD-fanart.jpg
smb://192.168.0.2/HD Films/2 Guns (2013)/2 Guns (2013)-fanart.jpg

The kodi log should tell you what kind of error is occurring when accessing these smb:// paths. Fix the Kodi image access issue and the caching should then work.
Cheers for the tip.......I've verified that I have read/write access to the folders and files on the shares (via smb), I've done that by navigating to the inbuilt file browser in kodi -> navigating to the share where I can create folders and rename folders/files.

I've popped kodi into debug and am rerunning the script, I'll let you know what I find.....
Not sure of your "Kodi history" but you mentioned "since your move to Linux" so maybe at one time you were using Windows, but unlike Windows, Linux paths are case sensitive so if the on-disk paths have been renamed (eg. changing the case of some parts of the filename) then a Linux client may not be able find the files when using the old paths stored in the database.
(2020-02-26, 16:07)Milhouse Wrote: [ -> ]Not sure of your "Kodi history" but you mentioned "since your move to Linux" so maybe at one time you were using Windows, but unlike Windows, Linux paths are case sensitive so if the on-disk paths have been renamed (eg. changing the case of some parts of the filename) then a Linux client may not be able find the files when using the old paths stored in the database.
that's a fair point, but no I never used windows to host the files. I used to run EMBER on windows to create the NFO's etc.....

I started with xbmcbuntu.......
(2020-02-26, 16:18)littlejeem Wrote: [ -> ]
(2020-02-26, 16:07)Milhouse Wrote: [ -> ]Not sure of your "Kodi history" but you mentioned "since your move to Linux" so maybe at one time you were using Windows, but unlike Windows, Linux paths are case sensitive so if the on-disk paths have been renamed (eg. changing the case of some parts of the filename) then a Linux client may not be able find the files when using the old paths stored in the database.
that's a fair point, but no I never used windows to host the files. I used to run EMBER on windows to create the NFO's etc.....

I started with xbmcbuntu....... 

hmmm, this is a weird one.....I've run kodi with the log set at debug (here) while running

Code:
texturecache.py c movies

but I can't see something that is obvious to me.......(i expected a bunch of error messages about access.

I believe that part of this script relies on json-rpc and I do see the following lines in the kodi debug log

Code:
2020-02-26 14:27:07.997 T:140052419660224   ERROR: JSONRPC Server: Failed to connect to sdpd

Could that be my problem?
(2020-02-26, 18:45)littlejeem Wrote: [ -> ]hmmm, this is a weird one.....I've run kodi with the log set at debug (here) while running

Code:
texturecache.py c movies

but I can't see something that is obvious to me.......(i expected a bunch of error messages about access.

Unfortunately you did not have debug logging enabled.

Based on the lack of any relevant errors, I'm assuming the script worked this time - no caching issues?

(2020-02-26, 18:45)littlejeem Wrote: [ -> ]
Code:
2020-02-26 14:27:07.997 T:140052419660224   ERROR: JSONRPC Server: Failed to connect to sdpd

Could that be my problem?

No, this is an unrelated Bluetooth issue - see https://forum.kodi.tv/showthread.php?tid=113428
(2020-02-26, 20:11)Milhouse Wrote: [ -> ]
(2020-02-26, 18:45)littlejeem Wrote: [ -> ]hmmm, this is a weird one.....I've run kodi with the log set at debug (here) while running

Code:
texturecache.py c movies

but I can't see something that is obvious to me.......(i expected a bunch of error messages about access.

Unfortunately you did not have debug logging enabled.

Based on the lack of any relevant errors, I'm assuming the script worked this time - no caching issues?

(2020-02-26, 18:45)littlejeem Wrote: [ -> ]
Code:
2020-02-26 14:27:07.997 T:140052419660224   ERROR: JSONRPC Server: Failed to connect to sdpd

Could that be my problem?

No, this is an unrelated Bluetooth issue - see https://forum.kodi.tv/showthread.php?tid=113428

Thanks @millhouse for taking a look, apologies for the amateur hour....

I'm getting the same errors in the script around chaching......let me do a proper debug log from Kodi and I'll repost...
In addition to the debug kodi log please also upload the matching texturecache log so that activity can be correlated.