Clean up XBMC’s screensaver cache to get rid of blurry low resolution slideshows.

10 September 2014 2 minutes

I have XBMC run a slideshow of family photos in screensaver mode. Problem? XBMC caches the images automatically and therefore the photos are replaced by low-resolution, blurry cached copies. This is noticeably annoying especially if you have large, hi-res TV. I approached the developer of the screensaver addon about the problem but it is out of his hands because the cache are managed system-wide (within XBMC of course).

So I came up with a workaround using texturecache.py. You’ll need to do the following:

  • Install and test texturecache.py. Instruction is all there so I won’t go over the details. But the idea is you find the cache IDs of the photos by matching paths somehow. My path to the slideshows contain “family_slideshow” which is unique so I can simply search for it: $> ./texturecache.py s “family_slideshow”. Make sure you test thoroughly and that you can see the proper high-res slideshow.

  • Once you’ve got texturecache.py working, use the following script and change the SEARCH_STRING, XBMC_USR, XBMC_PWD variables appropriately.

#!/bin/bash
TIMEOUT=1
SEARCH_STRING="family_slideshow"
CURR=false
PREV=false
XBMC_USR="xbmc"
XBMC_PWD="xbmc"
TEXTURECACHE=/storage/.config/texturecache.py
while true; do
CURR=`curl -s -u $XBMC_USR:$XBMC_PWD -X POST -H 'Content-type: application/json' -d \
'{"jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "params": { "booleans": \
["System.ScreenSaverActive "] }, "id": 1}' http://localhost:8080/jsonrpc|awk -F ':' \
'{printf substr($5,1,length($5)-2)}'`
if [ "$CURR" != "$PREV" ] ; then
echo "state changed -> clean up"
IDS=$($TEXTURECACHE s "$SEARCH_STRING" 2>&1 1>/dev/null | sed "s/.*: //")
[ -n "$IDS" ] && $TEXTURECACHE d $IDS 2>&1 1>/dev/null
fi
PREV=$CURR
sleep $TIMEOUT
done
  • Test run and try to do a “Preview” of the screensaver, you should see state changed -> clean up output every time the screensaver is activated/deactivated

  • Make the script auto-start with XBMC


Previous

OpenELEC: kills XBMC using keyboard or remote

I recently ditched my aging 12.04-Ubuntu-based XBMC setup to go with OpenELEC which is purposed-built and thus very fast. Because it is so streamlined, you lose the flexibility of a full-blown distro setup. One of which was the lack of lircd support on the recent builds. With my previous setup, I could use lircd to map a particular keyboard/remote key to a script that would kill and restart xbmc when it hang.

Next

TVVN 0.9.8

Just a quick update that I’ve just released a new version of TVVN (0.9.8) to the official repo. Based on past experiences, it will take a couple days to hit the mirrors. Meanwhile (and going forward for that matter) you can go to the github release page to get the latest version.