Tracks Rotation SQL Query: Load five songs from the requests table

This bit of code should populate the playlist with five songs that have appeared in the requests table, randomly, and obey the settings for the track/artist repeat rules:

SELECT songs.ID, songs.artist, songs.title FROM songs LEFT JOIN requests ON songs.ID= requests.songID LEFT JOIN queuelist ON songs.ID = queuelist.songID OR songs.artist = queuelist.artist WHERE songs.enabled=1 AND ((start_date <= Now()) AND (end_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.songID IS NULL OR queuelist.artist IS NULL) AND songs.ID= requests.songID AND songs.song_type=0 ORDER BY RAND() DESC LIMIT 5; Tags: #radio automation, #RadioDJ

=> 📝 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-the-requests-table.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
834.711996 milliseconds
Gemini-to-HTML Time
0.296708 milliseconds

This content has been proxied by September (3851b).