Tracks Rotation SQL Query: Load five songs from a playlist

This bit of code should populate the playlist with five songs that appear in a playlist that has been saved to the RadioDJ database, randomly, and obey the settings for the track/artist repeat rules:

SELECTsongs.ID,songs.artist,songs.titleFROMsongsLEFT JOINqueuelistON (songs.ID=queuelist.songIDORsongs.artist=queuelist.artist) LEFT JOINplaylists_listON (songs.ID=playlists_list.sID) WHEREsongs.enabled=1 AND ((start_date= NOW() ORend_date= '2002-01-01 00:00:01')) AND (TIMESTAMPDIFF(MINUTE,date_played, NOW())>$TrackRepeatInterval$ AND TIMESTAMPDIFF(MINUTE,artist_played, NOW())>$ArtistRepeatInterval$) AND (queuelist.songIDIS NULL ORqueuelist.artistIS NULL) AND (playlists_list.pID= '3') ORDER BY RAND() LIMIT 5;

Note: The number value for the playlist ID in line AND (playlists_list.pID= '3') can be found in the playlists table...

Explanation of why one would wanna do this: Say I wanna have certain songs appear a little more often, and keep them in regular rotation... or, maybe I wanna create a special block/set of certain songs... Well, I go create a "playlist" using the playlist builder, save it, then add this code to the Tracks Rotation rules.

Other potential uses include using a playlist as a store for certain sets of commercials, etc., and having them loaded randomly or in order...

Idea and code from the RadioDJ forums: http://www.radiodj.ro/community/index.php?topic=6658.msg39493#msg39493[1] Tags: #radio automation, #RadioDJ

=> 1: http://www.radiodj.ro/community/index.php?topic=6658.msg39493#msg39493

=> 📝 Comment on this post

=> 🔙 Previous Page

Proxy Information
Original URL
gemini://kg4vma.duckdns.org/gemfeed/2015/2015-06-09-tracks-rotation-sql-query-load-five-songs-from-a-playlist.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
885.062192 milliseconds
Gemini-to-HTML Time
0.30384 milliseconds

This content has been proxied by September (ba2dc).