Kodi Community Forum
[RELEASE] Texture Cache Maintenance utility - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: [RELEASE] Texture Cache Maintenance utility (/showthread.php?tid=158373)



RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-11-18

You need to at least enable debug logging..

"special://thumbnails" should map to your ~/.kodi/userdata/Thumbnails folder - have you checked if the files are actually there?

Sometimes Kodi will return an error when "downloading" (ie. caching) artwork which results in the script believing the artwork couldn't be cached, but Kodi does in fact successfully cache the artwork, so it's possibly a false negative - search your cache to see if the artwork has actually been cached, ie.:
Code:
texturecache.py s tt0066206_fanart.gif
If the above search lists the cached item (the second column will be something like e/e79ceed5.gif) in addition to your original artwork in the "animatedgifs" folder then it's just a false negative and nothing to worry about.

Alternatively:
Code:
texturecache.py nc movies Patton

will list any artwork for the movie "Patton" that remains uncached, so if this lists your gifs then it's definitely not being cached.

It's also possible that Kodi simply cannot cache gif artwork - it's not really a format I'm familiar with. If you can view the GIF artwork in the Kodi GUI, but the artwork remains uncached (as far as this script is concerned) then Kodi isn't caching GIF artwork, or it's caching GIF artwork differently to how it caches non-GIF artwork.


RE: [RELEASE] Texture Cache Maintenance utility - Simorgh - 2016-11-18

This is texturecache.cfg:

Code:
#userdata = ~/.xbmc/userdata/
#userdata = /home/osmc/.kodi/userdata/
userdata = ~/.kodi/userdata/
#dbfile = Database/Textures13.db
dbfile = ~/.kodi/userdata/Database/Textures13.db
#thumbnails = Thumbnails/
thumbnails = ~/.kodi/userdata/Thumbnails/
#xbmc.host = localhost
#webserver.port = 8080
#rpc.port = 9090
#download.threads = 2
#extrajson.albums  =
#extrajson.artists =
#extrajson.songs   =
#extrajson.movies  =
#extrajson.sets    =
#extrajson.tvshows.tvshow =
#extrajson.tvshows.season =
#extrajson.tvshows.episode=
#qaperiod = 30
#qa.file = no
#cache.castthumb = no
#logfile =
#logfile.verbose = no
#network.mac = aa:bb:cc:dd:ee:ff

I restarted the machine and connected the HDMI cable and the error went away.
the log is like this now:

Code:
15:56:55  34.077522 T:1956869040  NOTICE: Running the application...
15:56:56  35.278069 T:1956869040  NOTICE: starting zeroconf publishing
15:56:56  35.311073 T:1956869040  NOTICE: WebServer: Started the webserver
15:56:56  35.311394 T:1956869040  NOTICE: starting upnp client
15:56:56  35.323143 T:1675809776  NOTICE: ES: Starting UDP Event server on 127.0.0.1:9777
15:56:56  35.323509 T:1675809776  NOTICE: UDP: Listening on port 9777
15:57:15  53.732117 T:1777521648 WARNING: CSkinInfo: failed to load skin settings
16:03:01 399.508423 T:1759958000  NOTICE: VideoInfoScanner: Starting scan ..
16:04:29 487.599243 T:1759958000  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 01:28
16:06:03 581.556030 T:1956869040  NOTICE: Samba is idle. Closing the remaining connections

On one of my machine I installed Aeon MQ 7, and that is probably why it has started to download animated posters and gifs. but why can't it get them I am wondering.


RE: [RELEASE] Texture Cache Maintenance utility - Simorgh - 2016-11-18

IGNORE this post. I realized that I can't have full path in 'thumbnails = '





Code:
./texturecache.py r
FATAL: The task you wish to perform requires read/write file
       access to the Thumbnails folder, which is inaccessible.

       Specify the location of this folder using the thumbnails property
       as an absolute path or relative to the userdata property.

       The currently configured Thumbnails path is:
       /home/osmc/.kodi/userdata/~/.kodi/userdata/Thumbnails/

       Check userdata and thumbnails settings in properties file texturecache.cfg

I had /home/osmc/.kodi/userdata/ before, but then I changed it in the .cfg file to ~/.kodi/userdata/
But as you see, it now has both. does the script somehow save it somewhere beside the .cfg file?


RE: [RELEASE] Texture Cache Maintenance utility - Simorgh - 2016-11-18

(2016-11-18, 00:05)Milhouse Wrote: You need to at least enable debug logging..

"special://thumbnails" should map to your ~/.kodi/userdata/Thumbnails folder - have you checked if the files are actually there?

Where can I set it so special://thumbnails point to ~/.kodi/userdata/Thumbnails folder?

(2016-11-18, 00:05)Milhouse Wrote: Sometimes Kodi will return an error when "downloading" (ie. caching) artwork which results in the script believing the artwork couldn't be cached, but Kodi does in fact successfully cache the artwork, so it's possibly a false negative - search your cache to see if the artwork has actually been cached, ie.:
Code:
texturecache.py s tt0066206_fanart.gif
If the above search lists the cached item (the second column will be something like e/e79ceed5.gif) in addition to your original artwork in the "animatedgifs" folder then it's just a false negative and nothing to worry about.

Code:
Cosmc@SimorghOSMC:~$ ./texturecache.py s tt0066206_fanart.gif
Matching row ids:
This is what I get.
(2016-11-18, 00:05)Milhouse Wrote: Alternatively:
Code:
texturecache.py nc movies Patton

will list any artwork for the movie "Patton" that remains uncached, so if this lists your gifs then it's definitely not being cached.

Code:
osmc@SimorghOSMC:~$ ./texturecache.py nc movies Patton
Need to cache: [animatedfanart] for movie: Patton

Cache pre-load activity summary for "movies", filtered by "Patton":

              |  animatedfanart|    fanart   |    poster   |    TOTAL
--------------+----------------+-------------+-------------+-------------
Cached        |        -       |      -      |      -      |      0
Deleted       |        -       |      -      |      -      |      0
Duplicate     |        -       |      -      |      -      |      0
Error         |        -       |      -      |      -      |      0
Ignored       |        -       |      -      |      -      |      0
Not in Cache  |        1       |      -      |      -      |      1
Skipped       |        -       |      1      |      1      |      2
Undefined     |        -       |      -      |      -      |      0
=========================================================================
TOTAL         |        1       |      1      |      1      |      3

       Loading: 00:00:00.10
       Parsing: 00:00:00.00
     Comparing: 00:00:04.26
TOTAL RUNTIME: 00:00:04.37

I don't know if I have screwed things or what.


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-11-18

(2016-11-18, 01:28)Simorgh Wrote: Where can I set it so special://thumbnails point to ~/.kodi/userdata/Thumbnails folder?

The path ("special://thumbnails/blah") is configured in your media libary and has been set by something, an add-on presumably. If you want to change the path you need to reconfigure the add-on that is adding this GIF artwork to your media library. That said, "special://thumbnails" should already map to "~/.kodi/userdata/Thumbnails" within Kodi, so I'm not entirely sure what you hope to gain by changing the path.

Changing the "thumbnails" folder property in texturecache.cfg will also have no effect on the caching option, as it doesn't use this property. This property applies only to something like the "r" option which does require direct file system access, and in this case the "thumbnails" property is usually relative to the "userdata" property.

However as you are using OSMC, you shouldn't need to configure any path - not userdata, thumbnails or dbfile. Just leave them as their default values (ie. don't include them in your texturecache.cfg) and the script will work fine.

(2016-11-18, 01:28)Simorgh Wrote: I don't know if I have screwed things or what.

I just don't think Kodi wants to cache GIF artwork, in which case there's really not much you can do other than to add the following to texturecache.cfg:
Code:
cache.ignore.types=+.*.gif$
so that GIF artwork is ignored by the texturecache.py caching process. Problem solved...


RE: [RELEASE] Texture Cache Maintenance utility - Simorgh - 2016-11-18

@Milhouse Thank you for your time.

I think I understand what is happening here. But maybe you can help me too. (I am not a computer savvy person and I learn slow)

My RPi3 (10.0.1.120) runs OSMC and is the MySQL server. I have 3 other RPi2's (running LibreELEC) in the house and they are all bringing the database off of the RPi3. The texturecache.py script is on the RPi3 (10.0.1.120).

Yesterday, I installed Aeon MQ 7 skin on one of the RPi2 (10.0.1.122). And the movie library on that skin obviously uses the animated GIFs, I have seen the poster animation while browsing the library. I logged into that RPi2 and looked inside the Thumbnails/ folder and there it was, a folder named animatedgifs/ and the file you asked me to run the following command is actually in there:
Code:
texturecache.py s tt0066206_fanart.gif

Code:
SimorghLibr:~/.kodi/userdata/Thumbnails/animatedgifs # ls -la tt0066206_fanart.gif
-rw-r--r--    1 root     root        547912 Nov 17 09:22 tt0066206_fanart.gif

The reason that texturesache.py can't cache those animated GIFs, can it be that I have to identify the 10.0.1.122 machine in the .cfg file as client or something?!

Once again thank you for you detailed explanations. Appreciated.


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-11-18

(2016-11-18, 05:00)Simorgh Wrote: The reason that texturesache.py can't cache those animated GIFs, can it be that I have to identify the 10.0.1.122 machine in the .cfg file as client or something?!

Sort of, yes.

The problem is that you're using a shared library which references GIF artwork that is only accessible to one client (10.0.1.122) and not your other clients because the path you're using for the GIFs maps to a local path rather than a networked path.

When you cache the library on any of your clients, each client is going to see (via the library) that these GIFs are associated with the movie and need to be cached, but only 10.0.1.122 has any chance of caching these files which don't exist on your other two clients. So you'll get "can't download" errors on the two clients that physically can't access the GIF files.

Your solutions are to:

1) ignore GIFs on the two clients other than 10.0.1.122 by using a suitable "cache.ignore.types" pattern (eg. ".*/animatedgifs/.*.gif$" should work, ignoring any gifs in the animatedgifs folder)
2) use a network resource as the location of the GIFs instead of burying them in the local Thumbnails folder, so that all your clients can physically access (and therefore cache) them

Assuming you have no plans to deploy Aeon MQ 7 to your other two clients, #1 is the easiest solution. Let's say you're running texturecache.py on your RPi3 server (without GIFs), and you have a lounge client (Aeon MQ 7 with local GIFs) and a bedroom client (Estuary skin, with no GIFs). Your texturecache.cfg should look something like:

Code:
# Common properties go here

# set a default section
section=server

[server]
kodi.host=10.0.1.120
cache.ignore.types=+.*/animatedgifs/.*.gif$

[bedroom]
kodi.host=10.0.1.121
cache.ignore.types=+.*/animatedgifs/.*.gif$

[lounge]
kodi.host=10.0.1.122

and now you can use "texturecache.py @section=lounge c movies" to cache everything including those gifs (assuming Kodi is willing to cache gifs - still no idea on that), and "texturecache.py @section=bedroom c movies" to cache everything apart from gifs.


RE: [RELEASE] Texture Cache Maintenance utility - firewater - 2016-11-28

Sorry, this has probably been asked a million times, but I've tried using the search function on this thread and I'm not finding any cases exactly like mine: I add all movies and series by manually making the .nfo files. I update them with plot, director, and so on, after so time and want them all to be refreshed at once, instead of having to retort to contex menu > information > refresh for each item. It seems that this addon can do this, right? Seems to be my last hope...

I believe the script would have to do something with "qa.nfo.refresh", but I don't know what to write beside that... I'd be running this script with Kodi's autoexec.py, if it matters.


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-11-28

Code:
texturecache.py qax movies @qaperiod=-1 @qa.nfo.refresh=999999

would refresh all movies (technically, it will remove from the library any media file associated with an nfo that has been modified in the previous 999999 days, then rescan the media file).

Replace "movies" with "tvshows" to refresh tvshows (ie. episodes), although it won't remove remove/refresh tvshow.nfo files for obvious reasons (it would mean deleting all your seasons and episodes).

However if you're refreshing everything, why not just delete MyVideos and rescan the library? You can backup/restore watched statuses with:
Code:
texturecache.py watched movies backup movies.dat
texturecache.py watched tvshows backup tvshows.dat
and then after re-scanning a fresh library, replace "backup" with "restore" to restore your saved watched statuses.


RE: [RELEASE] Texture Cache Maintenance utility - firewater - 2016-12-01

Thank you very much. What I don't get is how I am to execute the texturecache.py script. I tried making a separate runtexturecache.py script that contained the lines you gave me and running it with Kodi Callbacks plugin, but syntax error appears and it doesn't work. Is this syntax for Kodi, Python, or some sort of command line?


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-12-01

(2016-12-01, 07:24)firewater Wrote: Thank you very much. What I don't get is how I am to execute the texturecache.py script. I tried making a separate runtexturecache.py script that contained the lines you gave me and running it with Kodi Callbacks plugin, but syntax error appears and it doesn't work. Is this syntax for Kodi, Python, or some sort of command line?

Command line.


RE: [RELEASE] Texture Cache Maintenance utility - Glorious1 - 2016-12-02

Hi,
I've been dipping my toes into texturecache.py the last week or so. Thank you Milhouse for this powerful program. I've managed to learn enough to get things going, but some things still elude me.

1. It would be easiest if I can run it remotely (from a MacBook to a Kodi installation on a Mac Mini). I've got that to work by specifying kodi.hosts=192.168.0.101 in the config file, but as noted in several posts, access to the Thumbnails folder is trickier. I should have no trouble giving an absolute path to the Thumbnails folder on the Mini, but the format eludes me. If I give anything not preceded by '/', it gets treated as a relative path. But these don't work:
thumbnails=/192.168.0.101/Users/jim/Library/Application Support/Kodi/userdata/Thumbnails
thumbnails=/afp://192.168.0.101/Users/jim/Library/Application Support/Kodi/userdata/Thumbnails
Am I missing some syntax issue?
Also, I don't understand why just Thumbnails relative to userdata doesn't work, as it works for the Database.

2. Apparently Kodi has to be running so the webserver is running for any of this to work? I tried the 'wake' command, that seems to only wake the computer. Is there an easy command line way to start Kodi on the Mini? Having to go through Screen Sharing is sometimes tedious.

3. I've put new logo.png files in the source folders of many movies (all of the artwork is local). To replace the previous ones, I did
./texturecache.py C movies
a. is there a way to specify only one type of artwork to re-cache?
b. Although the output indicated a bunch of logos were recached, Kodi (or the skin, Nebula), often didn't update them. Artwork Downloader solo showed that it "downloaded" a new logo, but still the old one showed in the skin. Not until I used Artwork Downloader GUI for the movie, and selected the logo, then the new logo showed up.

Enough for now! Thanks.


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-12-03

1. The thumbnails property is a relative path to the userdata folder/property. Mount your userdata folder, and then specify the absolute path to your mounted userdata folder in the userdata property. There's no need to change the thumbnails property. The thumbnails property exists because some users wanted to be able to specify an alternative/non-standard Thumbnails folder name. I think.

2. Yes. The webserver is only needed for caching. Use ssh to stop/start processes on a remote machine.

3a. "@cache.artwork=poster,fanart" would cache only poster and fanart artwork.
3b. Can't really help with third-party skin issues. However if the new logo is correctly associated with the movie, and the new logo is in the cache, then I can only imagine it's some issue caused by OS file caching which can happen if you recently viewed the old logo in the Kodi GUI - restart the PC or wait some time (a few minutes) and the changed artwork will appear.


RE: [RELEASE] Texture Cache Maintenance utility - Simorgh - 2016-12-03

Hi @Milhouse
Thank you for all your help and support.
I have been away and came back today to see if I can fix my issue. The challenge is that I have a RPi in the basement and a laptop that can not use my main WiFi router hence they are on a Netgear Extender which does not have an option to dedicate a static IP for the devices it connects. Therefore I can not use the options you mentioed in post #2077 http://forum.kodi.tv/showthread.php?tid=158373&pid=2458718#pid2458718

So I deactivated the animated art option in my bedroom RPi2 (skin: Aeon MQ 7) and deleted the /animatedgifs/ folder, restarted and it loaded up creating the /animatedgifs/ but with no files in it.
Should I now delete my Textures13.db file in my RPi3 (server) and run texturecache again? If so, which string(s) should I run so that would be the best?


(2016-11-18, 06:10)Milhouse Wrote: Your solutions are to:

1) ignore GIFs on the two clients other than 10.0.1.122 by using a suitable "cache.ignore.types" pattern (eg. ".*/animatedgifs/.*.gif$" should work, ignoring any gifs in the animatedgifs folder)
2) use a network resource as the location of the GIFs instead of burying them in the local Thumbnails folder, so that all your clients can physically access (and therefore cache) them


By the way I am interested in option #2 as well. Just for the future. How do I use a network resource as the location of the GIFs?

Thank you in advance.


RE: [RELEASE] Texture Cache Maintenance utility - Milhouse - 2016-12-04

(2016-12-03, 22:36)Simorgh Wrote: So I deactivated the animated art option in my bedroom RPi2 (skin: Aeon MQ 7) and deleted the /animatedgifs/ folder, restarted and it loaded up creating the /animatedgifs/ but with no files in it.
Should I now delete my Textures13.db file in my RPi3 (server) and run texturecache again? If so, which string(s) should I run so that would be the best?

If it's just an empty folder, why worry about it?

(2016-12-03, 22:36)Simorgh Wrote: By the way I am interested in option #2 as well. Just for the future. How do I use a network resource as the location of the GIFs?

You need to configure the GIF location using a network path - eg. nfs://, smb://, etc. Whether this is even possible needs to be answered by the author of the add-on or skin that is creating/using the animated gifs.