Help: Is the addon_data folder somehow cached?
#1
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:
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:
Image

Kodi output without a restart:
Image
 
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#2
(2019-10-04, 16:30)sualfred Wrote: -> "<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

Have you tried using "special://" paths instead of local?
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
Yep, tried all scenarios. Even image:// with encoded path.

I also have a background service running that is also creating an image (background blurred), that works well. And I've noticed that the issues does not appear if I disable the background blurring. What the f...
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#4
(2019-10-04, 17:11)sualfred Wrote: Yep, tried all scenarios. Even image:// with encoded path.

I also have a background service running that is also creating an image (background blurred), that works well. And I've noticed that the issues does not appear if I disable the background blurring. What the f...

Odd, what about
xml:
<texture background="true">
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
No difference.

As I said, if I simply copy a dummy image to the addon data folder it's also not visible in Kodi without a restart.
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#6
@Lunatixz 

I found the issue.
In my service I have a one time task when the service starts:

python:

    def __init__(self):
        addon_data_cleanup()
        service_start()
        .....

   def addon_data_cleanup(self,number_of_days=60):
        time_in_secs = time.time() - (number_of_days * 24 * 60 * 60)
        dirs, files = xbmcvfs.listdir(ADDON_DATA_IMG_PATH)

        for file in files:
            full_path = os.path.join(ADDON_DATA_IMG_PATH, file)
            stat = xbmcvfs.Stat(full_path)

            if stat.st_mtime() <= time_in_secs:
                xbmcvfs.delete(full_path)

For some reasons this function is "blocking" the folder. Can you tell me why?
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#7
Solved it by using 'os' instead of xbmcvfs. Totally weird, but OK. But it would be interesting to know why xbmcvfs was causing troubles in this scenario.

python:


        for file in os.listdir(ADDON_DATA_IMG_PATH):
            full_path = os.path.join(ADDON_DATA_IMG_PATH, file)
            if os.path.isfile(full_path):
                stat = os.stat(full_path)
                if stat.st_mtime <= time_in_secs:
                    os.remove(full_path)

Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply

Logout Mark Read Team Forum Stats Members Help
Help: Is the addon_data folder somehow cached?0