[RELEASE] Texture Cache Maintenance utility
Thanks so much! Got it working now. (Saved almost 500 MB or 25-30% space.) It takes many minutes to delete the images from each site, and I have dozens here.

A Shell Script

As you can tell I'm only marginally competent with unix, but I was able to make a simple shell script ("tckill.sh") that looks like this:

Code:
#!/bin/bash
# tckill.sh
echo "starting delete for youtube"
IDS=$(texturecache.py x 'where lasthashcheck = "" and url like "%youtube%"' 2>&1 1>/dev/null | grep "Matching row ids" | cut -b19-)
[ -n "$IDS" ] && texturecache.py d $IDS
echo "starting delete for nickelodeon"
IDS=$(texturecache.py x 'where lasthashcheck = "" and url like "%nickelodeon%"' 2>&1 1>/dev/null | grep "Matching row ids" | cut -b19-)
[ -n "$IDS" ] && texturecache.py d $IDS
# repeat with as many sites as needed
echo "all done"

Notes for the similarly marginally competent:

• I put the script in /usr/bin/ (in my $PATH) and now, as expected, so I could type "texturecache.py" rather than "./texturecache.py". But I didn't expect that I could no longer use "./texturecache.py". Not sure why. Minor thing. But that explains why the above shell script is written that way rather than the way Millhouse put it in post #440.

• I was not able to find a text editor that worked on the ATV. neither vi, emacs, or pico are installed. Rather than figure that out, I just created and edited the shell script on my Mac and uploaded it to /usr/bin/ next to texturecache.py

• Of course that has to be made executable like texturecache.py itself (with "chmod +x tckill.sh")

• on the ATV, it really is necessary to create the texturecache.cfg file as given kindly by Millhouse in post #451.

• it might not be obvious to others (as it wasn't to me at first) that the texturecache.cfg file should live next to (at the same directory level) as texturecache.py

• I was able to get this all to work without messing with any additional installation of SQlite. The only thing I did other than install this script was install Python 2.7.3 as directed in post #1.

Scheduling

cron is not installed on the ATV. Apple uses launchd for scheduling on OS X and someone here found it works on the ATV too. I'm sure one could find more concise examples. I will look into that further at a later date if needed.

Questions

• any bright way to make the above script give a bit of feedback, such as how many IDs found, and how many IDs deleted? and/or time started and finished for each site?

• and or even more advanced, how to loop it and give a list of sites as a variable?

Suggestions

This all works fine in the end. But you might consider making this simpler by having a format in texturecache.py itself like:

Code:
texturecache.py kill 'site1, site2, site3' -unhashed

(with -unhashed being an option along the lines explained in post #440).

Thanks again for your help.
Reply


Messages In This Thread
RE: [RELEASE] Texture Cache Maintenance utility - by ctawn - 2013-11-09, 13:54
Crash on Gotham on OS X - by desepticon - 2014-05-29, 17:57
Cleaning - by AleisterHH - 2018-05-28, 22:03
RE: Cleaning - by Milhouse - 2018-05-28, 22:16
qax genre not updated - by Just-Me_A-User - 2018-06-12, 22:06
RE: qax genre not updated - by Milhouse - 2018-06-12, 23:40
Logout Mark Read Team Forum Stats Members Help
[RELEASE] Texture Cache Maintenance utility17