absolute thumbnail path: correct method to retrieve?
#1
hi

following problem: i need the absolute path for the thumbnail of the currently played video.

i am using xbmc.getCacheThumbName() but this only returns a filename which cannot be used directly, eg: 8765432.tbn'.
the 'real' file would be (on linux): /home/someuser/.xbmc/userdata/Thumbnails/Video/8/auto-8765432.tbn

i couln't find a 'clean' / 'beautiful' way for this and i am now using this code:

thumbnail_rel = xbmc.getCacheThumbName( xbmc.getInfoLabel("Player.Filenameandpath") )
thumbnail_abs = xbmc.translatePath( "special://profile/Thumbnails/Video/" ) + thumbnail_rel[0] + "/auto-" + thumbnail_rel

it works. but is there a better way for this?
Reply
#2
use os.path.basename would be cleaner / better
Reply
#3
what does os.path.basename improve / do better here?

what i want to improve is: avoiding concatination of path to the video cache + first char. of xbmc.getCacheThumbName() + "auto-" + xbmc.getCacheThumbName().





Reply
#4
You could still try to get it directly from the player.

Example: icon = "file://%s" % xbmc.translatePath(xbmc.getInfoImage("VideoPlayer.Cover"))
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
yep, getInfoImage() does the trick. thanks!

i've tried xbmc.getInfoLabel("VideoPlayer.Cover") before but this one returned an empty string ...

but xbmc.getInfoImage() returns exactly what i want.
Reply
#6
Glad to hear Wink
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
here i'm again with another thumbnail problem:

this time i'd need the cached thumbnail of a youtube item:

xbmc.getInfoLabel("VideoPlayer.Cover") returns the 'youtube'-URL of the thumbnail, eg: http://i.ytimg.com/vi/blahblabla/0.jpg, but the image has already been cached by youtube-plugin (i can find it in the userdata-directory) so it would be fine to use the thumbnail that has already been cached and not to re-fetch it.
Reply
#8
You won't be refetching it, just set the thumbnail to that URL and XBMC will take care of the rest.
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
#9
the python service processes the information for a daemon that is not a part of XBMC (thus i'd need the absolute file name of the cached image).
Reply
#10
i've found a rather ugly, but working 'workaround':

Code:
currentitem['Thumbnail'] = xbmc.translatePath(xbmc.getInfoImage("VideoPlayer.Cover"))
if currentitem['Thumbnail'][0:7] == "http://" or currentitem['Thumbnail'][0:8] == "https://":
  thumbnail_rel = get_crc32(currentitem['Thumbnail'])
  pos = currentitem['Thumbnail'].rfind(".")
  if (pos > 0):
    currentitem['Thumbnail'] = xbmc.translatePath( "special://profile/Thumbnails/" ) + thumbnail_rel[0] + "/" + thumbnail_rel + currentitem['Thumbnail'][pos:]

but maybe there's a more beautiful way for this ...

(get_crc32() is the method that i've found somewhere in the xbmc-wiki)
Reply
#11
Just so you know, that will not be reliable going forward at all.
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
#12
@jmarshall - will there be a method for updating the artwork(Thumbnails or the paths stored in XBMC's Databases)? I ask as there are a couple of scripts(cdART Manager and Artwork Downloader) that update the Thumbnail path during their downloads and at the moment there is not a method to change the artwork path(except through HTTP-API)

Reply
#13
@giftie
There is a PR that will allow us to set a new path for thumbnails+fanart through JSON-RPC. I tested this and works like expected.
Only thing that is missing is a way to recache the current path or recache a certain image file location for example a cdart.png or logo.png
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#14
Ok.. I see the pull request for Video. Audio probably will follow after the texture cache is extended.

Reply
#15
Quote:Just so you know, that will not be reliable going forward at all.

that's why i'm calling it an 'ugly workaround' ...

it will work most of the time (finding something via its hash will never be 100% relieable).
but querying the database is a little bit too much overhead ...
and if i'll show the wrong icon in a rather rare case is - imho - better than reloading every 'URL'-thumbnail .

but anyway: if there's a clean / better solution: i'd be very interested ...
Reply

Logout Mark Read Team Forum Stats Members Help
absolute thumbnail path: correct method to retrieve?0