Expose the texture cache to JSON-RPC.

As requested (ages ago) by MilhouseVH and others on the forum.  Allows various cleanup scripts to do their cleanup jobs without messing with the database directly.

Currently this PR also contains significant re-work of CSmartPlaylistRule et. al. which this depends on.  Obviously I'll move out the new CDatabaseQueryRule* classes to a new file (in db_wrappers most likely).

@Montellese to review.  Ideally this is Gotham material, as having well-used scripts accessing the database directly is a bad idea for user systems.