2019-10-04, 16:30
I'm having troubles by accessing images that are created in my addon_data folder.
For some reasons Kodi won't display them until a reboot of Kodi. They aren't cached too and not listed in the thumbnails folder or in the textures.db
Is the addon_data folder somehow cached?
For testings I simply copied a dummy test.jpg to that folder and it's also not possible to show it in Kodi.
-> "<texture>E:\Kodi\Kodi Leia\portable_data\userdata\addon_data\script.embuary.helper\img\test.jpg</texture>" -> won't be displayed without a reboot of Kodi
-> "<texture>E:\test.jpg</texture>" -> works
Any way to work around this behaviour?
Code:
Created images in the folder:
Kodi output without a restart:
For some reasons Kodi won't display them until a reboot of Kodi. They aren't cached too and not listed in the thumbnails folder or in the textures.db
Is the addon_data folder somehow cached?
For testings I simply copied a dummy test.jpg to that folder and it's also not possible to show it in Kodi.
-> "<texture>E:\Kodi\Kodi Leia\portable_data\userdata\addon_data\script.embuary.helper\img\test.jpg</texture>" -> won't be displayed without a reboot of Kodi
-> "<texture>E:\test.jpg</texture>" -> works
Any way to work around this behaviour?
Code:
python:
def genre_thumb(genre,images):
filename = genre + '_' + md5hash(images) + '.jpg'
genre_thumb = os.path.join(ADDON_DATA_IMG_PATH, filename)
if xbmcvfs.exists(genre_thumb):
touch_file(genre_thumb)
else:
width, height = 356, 533
cols, rows = 2, 2
thumbnail_width = int(width / cols)
thumbnail_height = int(height / rows)
size = thumbnail_width, thumbnail_height
''' copy source posters to addon_data/img/tmp
'''
posters = list()
for poster in images:
posterfile = images.get(poster)
temp_filename = genre + '_' + md5hash(posterfile) + '.jpg'
image = _copyimg(posterfile,ADDON_DATA_IMG_TEMP_PATH,temp_filename)
if image:
posters.append(image)
if not posters:
return ''
''' create collage with copied posteres
'''
collage = Image.new('RGB', (width, height), (19,19,19))
collage_images = []
for poster in posters:
try:
image = ImageOps.fit(poster, (size), method=Image.ANTIALIAS, bleed=0.0, centering=(0.5, 0.5))
collage_images.append(image)
except Exception:
pass
i, x, y = 0, 0 ,0
for row in range(rows):
for col in range(cols):
try:
collage.paste(collage_images,(int(x), int(y)))
except Exception:
pass
i += 1
x += thumbnail_width
y += thumbnail_height
x = 0
collage.save(genre_thumb,optimize=True,quality=85)
''' delete temporary copied files
'''
_deltemp()
return genre_thumb
Created images in the folder:
Kodi output without a restart: