Kodi Community Forum
HOWTO - Force refresh of all library art - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: HOWTO - Force refresh of all library art (/showthread.php?tid=323954)

Pages: 1 2


RE: HOWTO - Force refresh of all library art - izprtxqkft - 2023-09-13

(2023-09-13, 23:09)jbinkley60 Wrote: Even using my approach of setting the lasthashchecked date back 3 days ?  If so, that shouldn't happen.

"any" may have been too vague, i did a few things to invalidate the data so that kodi would reload it
including setting the cachedurl to the url so that the cached image would be the original
and update set hash = ""
and update set cachedurl = ""
but not your solution

-----

with your solution i did UPDATE texture SET lasthashcheck = "2023-09-01 00:00:00"

but it did not invalidate the cache for unknown reasons, all the artwork is coming from jellyfin http://<server>/ and jellyfin touches kodi directly so i just chalked it up to jellyfin
even with container refresh the items still loaded from last and did not recache as they did when executing a delete


RE: HOWTO - Force refresh of all library art - jbinkley60 - 2023-09-14

(2023-09-13, 23:19)jepsizofye Wrote: with your solution i did UPDATE texture SET lasthashcheck = "2023-09-01 00:00:00"

but it did not invalidate the cache for unknown reasons, all the artwork is coming from jellyfin http://<server>/ and jellyfin touches kodi directly so i just chalked it up to jellyfin
even with container refresh the items still loaded from last and did not recache as they did when executing a delete

That seems very odd.  I will need to do some testing.  Part of the reason I wrote the textures utility in the Mezzmo Kodi addon was the scenario where i would browse a playlist or similar in Kodi and see a piece of artwork which was wrong in the Mezzmo library.  Mezzmo hosts artwork centrally by URL too and the URLs rarely change.  So Kodi would cache the image in the textures database and so even when I would fix it in Mezzmo it would continue to show the old image in Kodi for some time.  When you access a Mezzmo piece of artwork Kodi blanks out the lasthashchecked field and the Mezzmo Kodi addon has a background service which checks every 30 minutes and sets the date back 3 days.  It's been working fine for me.  I'll do some testing when I get a minutes.

It writes out a log message so I can keep track of what it is doing:


2023-09-13 18:30:54.792 T:12100    info <general>: Mezzmo textures cache timers 24 rows updated.


I have a settings option which changes texture table value every time you begin to browse a playlist vs. on the timer but I generally don't recommend folks use it.  It forces a refresh every time like you are doing. 


Thanks,

Jeff


RE: HOWTO - Force refresh of all library art - izprtxqkft - 2023-09-14

(2023-09-14, 00:44)jbinkley60 Wrote: I'll do some testing when I get a minutes.

this works but i have to ReloadSkin() about 5 times before it kicks in and loads a new image, the image is being displayed on the main Home.xml so i am guessing whatever container can simply be refreshed instead of reloadskin

update texture set lasthashcheck=datetime('now', '-10 days') where id=129;

-----

edit:
*in db browser for sqlite, using sqlite's internal datetime function


RE: HOWTO - Force refresh of all library art - jbinkley60 - 2023-09-14

(2023-09-14, 02:01)jepsizofye Wrote: this works but i have to ReloadSkin() about 5 times before it kicks in and loads a new image, the image is being displayed on the main Home.xml so i am guessing whatever container can simply be refreshed instead of reloadskin

update texture set lasthashcheck=datetime('now', '-10 days') where id=129;

-----

edit:
*in db browser for sqlite, using sqlite's internal datetime function

Ahh, I think this is more of a skin behavior.  I am not viewing my artwork testing from the home screen and using Mezzmo's GUI mode which creates a playlist of listitems.  For the issue you describe I found that during the Mezzmo Kodi Addon sync process where it updates the Kodi database but the home screen doesn't reflect the change immediately.  The way I force that to update is via an Update Library command .  I have a settings option called Kodi Native Skin Updates, when enabled makes this call at the end of a sync process.   I played with many different options here including ReloadSkin and this is the only thing I could consistently force a refresh across skins.  It feels heavy handed but has worked for me.


Thanks,

Jeff.


RE: HOWTO - Force refresh of all library art - nazarux - 2023-09-14

The only builtin that actually work is the RestartApp, witch I wanted to avoid because it works only with Linux and Windows. But with this one I don’t have to DELETE FROM texture . Physically deleting Textures13 is enough.
Container.Refresh just reloads the addons icons for current listing (programs addons).
ReloadSkin kills Kodi.
In the log file I still get this:
2023-09-14 13:58:58.721 T:11103 error <general>: DoWork - Direct texture file loading failed for special://masterprofile/Thumbnails/5/5b3792fa.jpg

Then I’ve looked more carefully to my previous addon and there was a big difference.
I was deleting all the thumbnail files but not the thumbnails directory structure.

With this it doesn't work:

Code:
    thumbsPATH = xbmcvfs.translatePath('special://thumbnails')
    for root, dirs, files in os.walk(thumbsPATH):
            for f in files:
                try: os.unlink(os.path.join(root, f))
                except: pass
            for d in dirs:
                try: shutil.rmtree(os.path.join(root, d))
                except: pass

With this it works:

Code:
    for root, dirs, files in os.walk(thumbsPATH):
            for f in files:
                try: os.unlink(os.path.join(root, f))
                except: pass


So removing only the thumbnails files but not the directory structures makes everything goes as expected without any more tricks.

When I have some time I will try to move the previous addon to the new Kodi – is still working with 18 -Leia.
I’ve converted it to Python 3 witch was very easy. The problem is that some Kodi functions have changed. Some are directly replaced (i.e. xbmc.translatePath to xbmcvfs.translatePath) but others are deprecated and required more attention (i.e. iconImage and thumbnailImage to setArt())

Thanks everyone for all the trouble and help.