Problem using THumbnail-Cache
#1
Hello Community

while writing plugins i'am suffering a "strange" problem with the "thumbnail-cache"

see the following code:
Code:
import xbmc, xbmcgui, xbmcplugin,xbmcaddon, sys, urllib, os, time

xbmcgui.DialogProgress();

listItem=xbmcgui.ListItem("Test", iconImage="DefaultFolder.png", thumbnailImage="http://www.zdf.de/ZDFmediathek/contentblob/1191708/timg116x54blob/3888592")
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="noone",listitem=listItem,isFolder=True)

listItem=xbmcgui.ListItem("Test1", iconImage="DefaultFolder.png", thumbnailImage="http://www.zdf.de/ZDFmediathek/contentblob/1197638/timg116x54blob/3913562")
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="noone",listitem=listItem,isFolder=True)

xbmcplugin.endOfDirectory(int(sys.argv[1]))

if i run this code, both items Test and Test1 displays the same picture, depending on what item catch the "mouse-over" first. Internally it seems that the booth Picture-Links leads to the same hash value... my only attempt to get around this, is downloading the thumbnails by myself and storing it in the plugin-directory. Any better ideas?
Reply
#2
Try the links in a webbrowser Wink
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
id did, they are different or did i miss your point ?

Image

Image
Reply
#4
They're identical here. Perhaps some user-agent tricks?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Hmm, actually they're identical if the last number is pulled off the first link and dumped on the second - I didn't notice earlier that the rest of the URL isn't quite the same - my mistake.

Check your Textures.db file in something like sqlitespy and see what is listed for those two links.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
Check textures.db and see what is happening there... If it is a hash collision then you should go buy a lottery ticket immediately Wink

Seriously though, if it does turn out turn out to be a hash collision and you really want to get this to work you could do something like this. Its ugly. Its a hack. But it would work. Something like:

Code:
if url == "http://www.zdf.de/ZDFmediathek/contentblob/1191708/timg116x54blob/3888592":
  url = "".join( url, "?hashtrick=")

That was off the top of my head, so it may not be correct, but you get the idea. That particular url seems to ignore url params, so the server won't care about the extra parameter - but it should force xbmc's hash to generate a different value. Since the parameter is hardcoded it should also be repeatable.

Oh wait... I just looked at your code again. I can't remember for sure, but I think for plugins it hashes the item's url, not the thumbnail url... You have the url set to "noone" for both of themHuh That is probably the problem.
Reply
#7
Oh, and if you're using these in videos or music it'll be because the thumb is being cached based on the URL of the item, which is the same in both cases.

In pictures it will be fine - it would be good to confirm this.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
galvanash Wrote:Check textures.db and see what is happening there... If it is a hash collision then you should go buy a lottery ticket immediately Wink
instead of doing this, i would prever to seak the source code for something like "url.substring(...)" or for something like
galvanash Wrote:Oh wait... I just looked at your code again. I can't remember for sure, but I think for plugins it hashes the item's url, not the thumbnail url... You have the url set to "noone" for both of themHuh That is probably the problem.

ok this sounds as it's the problem. I put noone in there, cause i don't care for the item-url in this example. But if i think about my plugin, it has always the same url for the ListItems. These are all RTMP-BasePath and the "changing-part" is the PlayPath given as an Attribute to the ListItem.

Is there a way to change the behavior of xbmc-thumbnail-caching (without recompile Wink )?

PS: i will check this theory later this evening cause i'am at the office now...
Reply
#9
You was right, the thumbnails-hashes are build by the item.url

that sucks if these url is always the same Wink
Reply
#10
Hi guys, is there any news about that?

I am facing the same issue with a plugin, a list of sub categories change pretty often, and I am getting the old thumb on the worng categorie.
I checked the URL and it is a totally different, so I am not sure why the thumb is not generated.
Is there a way of cleaning cache?

i tried something like that:
Code:
THUMB_CACHE_PATH   = os.path.join( xbmc.translatePath( "special://profile/" ), "Thumbnails", "Video" )

    def clean_thumbnail(self, thumbnail_url):
        """
        Clean thumb
        This is done because XBMC does not use the right thumb in the case of sub categories while the right URL is passed to the ListItem
        """
        try:
            filename = xbmc.getCacheThumbName( thumbnail_url )
            filepath = xbmc.translatePath( os.path.join( THUMB_CACHE_PATH, filename[ 0 ], filename ) )
            if os.path.isfile( filepath ):
                os.remove(filepath)
                if self.debug_mode:
                    print "Deleted %s thumb matching to %s image"%(filepath, thumbnail_url)
            elif self.debug_mode:
                print "No thumb found %s thumb matching to %s image"%(filepath, thumbnail_url)
                
            return True
        except:
            print "Error: clean_thumbnail()"
            print_exc()
            return False
But for example For the URL: http://images.m6replay.fr/012800DE038141...10-jpg.jpg (note: the .jpg.jpg is not a mistake it is the way the URL is)

The image displayed is (on Linux)/home/user1/.xbmc/userdata/Thumbnails/Video/1/13528e6f.tbn while my function returns /home/user1/.xbmc/userdata/Thumbnails/Video/2/28f207cc.tbn

So pretty far, any idea why?

Thanks in advance for your help.
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#11
Ok, I have just found my mistake, I was passing to my function the URL of the Thumb to download, but the one that is used in order to create the cache name of the thumb is the URl of the VIDEO (not the picture).
Once I passed the URL of the video, the function above was able to delete the right thumb and recreate one.

In my case I think I understand now why thumbs are all messed up, since it is a category and the URL is a plugin URL (starting by //plugin), the title change but not necessarily the plugin URL.
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#12
Sorry about digging up a month-old thread, but I've run in to this problem mucking around writing a video plugin of my own.

The problem I have is that my video links are in relation to section/page/item numbers. This makes it _much_ tidier than passing the entire stream url within the parameters (which always irked me a bit). I could always add some extra unused parameter (like title), but this still means that it would be caching anew each time the list progressed - even though the actual image url remains unchanged. Also, the stream url is ran through Player().Play, so the image is cached there (from a listitem) via its actual url anyway.

Is there a good reason for the thumbnail to be cached at the video level rather than the actual thumbnail? Or is even asking volunteering myself to write a patch? (which I'd not be entirely adverse to, by the way)

Cheers
Reply
#13
Basically you'd have to change video thumbs from being cached on the URL of the fileitem to being cached on the URL of the thumbnail. This is probably reasonably straight forward to do for plugin:// URLs only, as the plugin sets the thumbnail image. Compare the CPictureThumbLoader with CVideoThumbLoader.

It's not as easy for videos in general - in particular for videos found while reading the filesystem. Reason is that we have to look on the disk to find the local thumb which is then used to lookup the texturecache. In this case, we'd want to cache the thumb image for the item - again, see how CPictureThumbLoader does this for folder thumbs - that's what you want there.

A patch would be most welcome Smile

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Problem using THumbnail-Cache0