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

Load Rotation built on Sql

Started by 3amradio, March 03, 2023, 01:05:46 AM

3amradio

Hello Everyone....

I was using a rotation built on Sql that calls a sweeper, a song, three bible chpapters (in order) and finaly another song, using "union". The problem came after updating RadioDJ. Now the event is repeating the same three bible verses 2 times. Even when count.played is set to <1 (to be play just one time).

Does anybody know why this is happenig?

This section brings the jingle

(SELECT songs.ID, songs.artist, songs.title FROM songs
WHERE songs.song_type = 1
AND songs.id_subcat = 11
AND songs.enabled = '1'
ORDER BY rand() ASC LIMIT 1)

This section brings the song
UNION

(SELECT songs.ID,  songs.artist, songs.title FROM `songs`
WHERE songs.song_type=0
AND songs.id_subcat BETWEEN 33 AND 35
AND songs.enabled= '1'
AND songs.id_genre = 1
AND songs.count_played<5
ORDER BY (songs.title) ASC LIMIT 1)

This section bings the Bible chapters
UNION

(SELECT songs.ID,  songs.artist, songs.title FROM `songs`
WHERE songs.song_type=0
AND songs.id_subcat =38
AND songs.title  LIKE 'Gen%'
AND songs.enabled= '1'
AND songs.id_genre = 1
AND songs.count_played<1
ORDER BY (songs.title) ASC LIMIT 3)

This section brings the jingle
UNION

(SELECT songs.ID, songs.artist, songs.title FROM songs
WHERE songs.song_type = 1
AND songs.id_subcat = 11
AND songs.enabled = '1'
ORDER BY rand() ASC LIMIT 1)

mdj

Happy to be corrected on this (and it explained to me), but I don't think that is how rotations items work?

Your query is producing a list with 6 items, then radioDj is selecting 1 of them at random.
You would need to break your rotation out into each item you want played, ie

Rotation Item 1: SQL to bring in Jingle,
Rotation Item 2: SQL to being in Song,
Rotation Item 3: SQL to bring in Bible Chapter,
Rotation Item 4: SQL to bring in Bible Chapter,
Rotation Item 5: SQL to bring in Bible Chapter,
Rotation Item 6: SQL to bring in Jingle.

So, remove the Union and spilt the SQL out into its own rotation Item. You may also need some extra smarts in the Bible Chapter SQL to choose the next one, as the count_played wont increment by virtue of being included in the queue list.

Mike.

mdj

It appears that I fundamentally don't understand rotations.

Apologies, please ignore the above.

Unrelated to your question. . . . Using the way that I thought it worked, I change some of my own rotations to give multiple results and (wrongly) let rDJ pick one, then wondered why my queuelist filled with multiple items that all had a sweeper on start.

TLDR: So if a SQL rotation item delivers multiple results, it'll populate multiple items in the queuelist.

The above occured on a 2.0.3.9 install, and I also tested it on a 2.0.0.6 install.

Sorry I can't help, but thanks for helping me understand rDJ a little better than I did.

Mike.




DJTechG

It's because it's still in the queue... it hasn't played yet so it'll still be 0 until it does. It's getting picked up with the first run of the query (as it should) ... the first item pops off, so it runs hte query again, but your bible verse hasn't played... so it gets picked up a second time... by the time it runs it a thrid time, the track has been played, so it selects the next one and the cycle repeats.

How you get around it by joining to the queue and making sure that the file isn't already in the queue.

-tg