User Tools

Site Tools


random_list

Differences

This shows you the differences between two versions of the page.


random_list [2021/04/12 20:58] (current) – created pinupadmin
Line 1: Line 1:
 +====== Random Playlist ======
 +
 +With the magic of sql active playlist we can make a few random playlists for your needs.
 +
 +Here are a few activesql playlists that do some randomness. Note you can change the where part to say only certain emulators and limit the # of games to return.
 +
 +Like following videos?: See this nice video: [[https://www.youtube.com/watch?v=-ZwC32AzgIM|https://www.youtube.com/watch?v=-ZwC32AzgIM]]
 +
 +Basic random list that changes each time you go into/out of playlist. uses all games and limits 10
 +<code>
 +
 +Select * from Games where visible=1 order by random() limit 10
 +
 +</code>
 +
 +===== Daily Random Playlist =====
 +
 +Lets say you want the same random playlist for day. So random tables will be different each 24 hours.
 +
 +<code>
 +select *,cast(strftime('%f',dateadded) as float)*gameid*gameid*cast(strftime('%d%m','now') as int)%(548664) as seed from games where visible=1 order by seed limit 10
 +
 +</code>
 +
 +===== Weekly Random Playlist =====
 +
 +Lets say you want the same random playlist for the week. So random tables will be different each week;
 +
 +<code>
 +select *,cast(strftime('%f',dateadded) as float)*gameid*gameid*cast(strftime('%W','now') as int)%(548664) as seed from games where visible=1 order by seed limit 10
 +
 +</code>
 +
 +
 +===== Monthly Random Playlist =====
 +
 +And lastly for a monthly random playlist
 +
 +<code>
 +select *,cast(strftime('%f',dateadded) as float)*gameid*gameid*cast(strftime('%m%Y','now') as int)%(548664) as seed from games where visible=1 order by seed limit 10
 +
 +</code>
 +
 +if you'd like to filter which emulators then you would need to find the EMUID #. (get that from emulator setup field)
 +
 +<code>
 +Select * from Games where visible=1 AND EmuID in (1,3) order by random() Limit 5
 +
 +</code>
 +
 +That will grab random from emulators 1 or 3, and grab 5 tables in total.
 +