Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Disable thumbnail cache for channel?

cncbcncb Posts: 118Members, Plex Pass Plex Pass

Is there a way to disable the thumbnail cache for a channel? That is, I want Plex to download the thumbnails each time since they will constantly be changing.

Best Answer

Answers

  • coder-alphacoder-alpha Posts: 365Members ✭✭✭

    This is from my experience, so it might not be 100% accurate.

    For all clients other than PlexWeb the cache system seems to do a compare. They also seem to follow the behavior as defined for the HTTP.CacheTime, HTTP.ClearCache() and ObjectContainer(no_cache=True). More on cache and ObjectContainer parameters in this informative post here.

    The cache when using PlexWeb is very unpredictable and does not seem to show any affect with the above declarations.

    However, you might be in luck... Twoure has written some nice tools that might come in handy for you.. https://github.com/Twoure/KissNetwork.bundle#cache-tools

    Hope that helps.

  • cncbcncb Posts: 118Members, Plex Pass Plex Pass

    @coder-alpha Thanks for the help. Unfortunately, those cache functions and options don't seem to apply to thumbnails (even in Plex Media Player). Twoure's tools might work but I don't want to clear out the entire cache, just those for my plugin. For now, I slightly modify the thumbnail URL each time which of course works but might eventually result in a large thumbnail cache if these are never cleared out (which seems to be the case).

  • coder-alphacoder-alpha Posts: 365Members ✭✭✭

    My understanding of @Twoure 's tool is it will empty cache of that plugin only, the way its currently written. https://github.com/Twoure/KissNetwork.bundle/blob/master/Contents/Code/DevTools.py#L613-L648

    and define type as well based on path I guess
    https://github.com/Twoure/KissNetwork.bundle/blob/master/Contents/Code/DevTools.py#L464-L472

  • TwoureTwoure Posts: 621Members ✭✭✭

    You can try adding a timestamp to your URLs.

    Example, your user image:

    # normal thumb
    thumb = "https://i0.wp.com/vanillicon.com/33fec7763372d6bd82c1d2d92ce6df63_200.png"
    
    # add a timestamp
    thumb = "https://i0.wp.com/vanillicon.com/33fec7763372d6bd82c1d2d92ce6df63_200.png?t=1486513402"
    
    # 't' is not special, just needs to be something not in use by the website
    thumb = "https://i0.wp.com/vanillicon.com/33fec7763372d6bd82c1d2d92ce6df63_200.png?shenanigans=1486513402"
    

    You could setup a function to add the timestamp value, and change it when needed... i.e. if you need new images always, then set the timestamp to the current time and have it update each time the thumb is called.

    Not sure if this method will work for all thumbs, but is worth a try. As stated above, you'll have to be careful of channel cache times.

  • cncbcncb Posts: 118Members, Plex Pass Plex Pass

    @Twoure That is my current workaround but I am concerned that the thumbnail cache will keep building up for each (slightly different) URL and never be cleared? Before modifying the URL so that a new thumbnail is retrieved each time, it was using thumbnails cached from several days before. So, I am not sure if the thumbnail cache is ever cleared automatically?

  • cncbcncb Posts: 118Members, Plex Pass Plex Pass

    OK, thanks to both of you for your help.

  • TwoureTwoure Posts: 621Members ✭✭✭

    @coder-alpha said:
    My understanding of @Twoure 's tool is it will empty cache of that plugin only, the way its currently written. https://github.com/Twoure/KissNetwork.bundle/blob/master/Contents/Code/DevTools.py#L613-L648

    Yup, that is correct.

    Yes, but this is not how channels normally work. I needed a way to access image URLs that required cookies. Plex Framework does not support cookies for URL images, so I resorted to locally saving the thumbs but not in the channel's resources directory because this could cause issues while updating my channel. Instead I decided to cache them within the channel's own support directory, and have them auto delete after a month. I also added a way for users to manually clear my channels caches, as it can solve problems from time-to-time that a user may be experiencing.

    To load the images, I use the DataObject(). Method adapted from @coryo123's data_object()

Sign In or Register to comment.