• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

2 songs back to back problem

Started by 93 Rock, April 15, 2023, 02:27:49 PM

93 Rock

So I run a "double shot" weekend on my station with 2 songs from the same artist played twice every hour. Basically how it's set up is I have a 2 event triggers that clear the playlist and reload a rotation with the script below. I've had issues where randomly I get 3 songs from the same artist in the playlist. (See Image) In some cases the same song repeats? It only happens every once in a while which is really strange. Is there a different code I should be using? I'd eventually love to know how to add a sweeper in-between the songs but that is a different conversation.

I'm also running version 2.0.3.8 at the moment


-- Select two tracks by same artist   

SELECT `ID`, `artist`, `title` FROM `songs` WHERE `artist`=(
SELECT `songs`.`artist` FROM `songs`
LEFT JOIN `queuelist` ON ( `songs`.`artist` = `queuelist`.`artist`)
WHERE `songs`.`enabled`=1
AND `songs`.`song_type`=0
AND ((`songs`.`start_date` <= Now()) AND (`songs`.`end_date` >= NOW() OR `songs`.`end_date` = '2002-01-01 00:00:01'))
AND ((TIMESTAMPDIFF(MINUTE, `songs`.`date_played`, NOW()) > $TrackRepeatInterval$) AND (TIMESTAMPDIFF(MINUTE, `songs`.`artist_played`, NOW()) > $ArtistRepeatInterval$))
AND  `queuelist`.`artist` IS NULL

-- Subcategory filter
AND `id_subcat` IN(30)

GROUP BY `songs`.`artist`
HAVING COUNT(*) > 1
ORDER BY `songs`.`date_played` ASC LIMIT 1)
AND `enabled`=1
AND `song_type`=0

-- Subcategory filter
AND `id_subcat` IN(30)

AND ((`start_date` <= Now()) AND (`end_date` >= NOW() OR `end_date` = '2002-01-01 00:00:01'))
AND ((TIMESTAMPDIFF(MINUTE, `date_played`, NOW()) > $TrackRepeatInterval$) AND (TIMESTAMPDIFF(MINUTE, `artist_played`, NOW()) > $ArtistRepeatInterval$))
ORDER BY RAND()
LIMIT 2;

Kiwi

I can't help with the codong but if you search the forum with "Twofer" you will find some examples of what you may be looking for. Others may be able to assist you more directly. All the best.

Chris2021

Another thought is that the problem maybe the version of RDJ rather than your SQL code.

QuoteI'm also running version 2.0.3.8 at the moment

Have you tried this on 2.0.0.6?

I believe this is the last production version of RDJ where SQL can check the queuelist for upcoming songs / artists. Speaking under the control of Marius it looks like there was a programming change after 2.0.0.6 which resulted in SQL no longer being able to control if artists or songs are pending to play in the queuelist. Hence tracks selected by SQL can & do repeat in later versions of RDJ.

Many of the SQL scripts on this forum were posted before the newer releases of RDJ. Hence controls like AND  `queuelist`.`artist` IS NULL worked at the time of posting.


Hope this helps. Good luck!



93 Rock

Ok, thanks for the info on that!

Quote from: Chris2021 on April 16, 2023, 10:19:56 PM
Another thought is that the problem maybe the version of RDJ rather than your SQL code.

Have you tried this on 2.0.0.6?

I believe this is the last production version of RDJ where SQL can check the queuelist for upcoming songs / artists. Speaking under the control of Marius it looks like there was a programming change after 2.0.0.6 which resulted in SQL no longer being able to control if artists or songs are pending to play in the queuelist. Hence tracks selected by SQL can & do repeat in later versions of RDJ.

Many of the SQL scripts on this forum were posted before the newer releases of RDJ. Hence controls like AND  `queuelist`.`artist` IS NULL worked at the time of posting.


Hope this helps. Good luck!