2013-12-18, 10:06
(2013-12-18, 01:50)nemj Wrote:Code:elif self.args.method == "Random":
picfanart = join(PIC_PATH,"fanart-date.png") #Just to have something, not needed?
filelist = [row for row in MPDB.cur.request( """SELECT strPath,strFilename FROM Files WHERE RANDOM() %% 100 == 0 ORDER BY RANDOM() LIMIT 250 OFFSET %s"""%(offset) )]
This is obviously too hardcoded, but could be possible to make nice(?) I found the trick WHERE RANDOM() %% k somewhere on the web, works great for largeish tables. k should ideally be set by k = COUNT(*) / limit
Maybe something to add, also as option in main menu ("View x random pictures")?
Good idea, especially for using with ruuk's screensaver.
But I don't see a reason for the where condition because
Code:
ORDER BY RANDOM() LIMIT 250