Just wanted to say thanks to fbuser for this fantastic component and figured I'd post my setup in case others might find it useful....
My use-case is I like random plays of my higher-rated music without repeats.
For the batch, I have this:
DROP VIEW IF EXISTS random_view4;
CREATE TEMP VIEW random_view4 AS
SELECT last_played, MetaDB_Handle
FROM medialibrary
WHERE rating = 4
AND last_played < '2011-09-09' AND ((julianday('now') - julianday(last_played)) > 42)
ORDER BY random()
LIMIT 40;
DROP VIEW IF EXISTS random_view5;
CREATE TEMP VIEW random_view5 AS
SELECT last_played, MetaDB_Handle
FROM medialibrary
WHERE rating = 5
AND last_played < '2011-08-10' AND ((julianday('now') - julianday(last_played)) > 21)
ORDER BY random()
LIMIT 20;
Simple enough. The dates and limits are arbitrary and work for me. Once I play through all of my 5's or 4's, I'll reset the date that gets compared to last_played to start the list over. The "julianday" portions are for when I reset the date -- this keeps recently-played tracks (three weeks for 5's and six for 4's) from ending up in the playlist.
The query is easy too:
SELECT * FROM random_view4
UNION
SELECT * FROM random_view5;
Many thanks to fbuser for the component.