tcleanup: massive speedup

Instead of running sqlite3 for each file, read all the watched
videos from the db and store them in a hash table, and query that.
Time went from 30 seconds to < second.