RadioDJ - Free Radio Automation Software Forum

Online Requests Plugin - DON'T play a request if it's in the queue already

Hi all,

I've tried searching for an answer to this, but can't seem to find anything.

Is there a way to not allow an online request to be submitted if it is already in the playlist?

I have a rotation that plays requests and tracks - however, if the track is already in the queue to be played (the "on air" queue not the request queue) it allows the request to be played, leaving the same song to potentially be played numerous times.

Just wondering if anybody has set their online requests to reject a request, like it does if it's already in the request queue?

Offline Jhonny

  • *****
  • 3679
  • Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Online Requests Plugin - DON'T play a request if it's in the queue already
« Reply #1 on: December 06, 2017, 09:25:48 AM »
Request from your web site?

R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.2.0 Beta

Re: Online Requests Plugin - DON'T play a request if it's in the queue already
« Reply #2 on: December 06, 2017, 12:55:57 PM »
I worked this out buy adding another MYSQL query to the PHP.  The query searches the SongID in the queuelist - if there are any matches, it will show the error that the song is already requested.

The code is here:

Code: [Select]
$inqueue = mysql_query("SELECT * FROM queuelist WHERE songID  = '$reqsongID'");
And the IF statement to check if the sond ID is already in the queue is here:

Code: [Select]
if(mysql_num_rows($inqueue) > 0) {
       $error = 3;
}

Hope it helps anybody who was having the same problem as me!

Offline Jhonny

  • *****
  • 3679
  • Peace, enjoy life.it's over before you've lived it
    • Jhonny's RadioDJ tutorials.
Re: Online Requests Plugin - DON'T play a request if it's in the queue already
« Reply #3 on: December 06, 2017, 03:08:48 PM »
My code is slightly different, exclude also subcats if set.

Code: [Select]
$trackid= $row['ID'];
 $sqlch= "SELECT COUNT(*) AS num FROM queuelist WHERE songID = ".$trackid." LIMIT 1";
 $trackresult = mysqli_fetch_array(mysqli_query($conn, $sqlch));
 $tottrack =  $trackresult['num'];

            if(track_can_play($row['date_played'], $row['artist_played']) == true && $tottrack == 0) {

                echo "  <td class=\"entry_no\" style=\"padding-left: 10px; padding-right: 10px\"><a href=\"$targetpage?page=$page&requestid=" . $row['ID'] . "\" title=\"" . $lang['ALT_REQ'] . "\"><button>".$lang['REQ_SELECT']."</button></a></td>";
            }else{
                echo "  <td class=\"entry_no\" style=\"padding-left: 10px; padding-right: 10px\"><center><span style=\"background-color: #FF9966\"><span style=\"font-size: 8pt\"><img src=\"img/no-track.gif\" height=\"24\" title=\"".$lang['REQ_TRACKS_NOT']."\"></span></span></center></td>";
            }

            echo " </tr>";
            $cnt++;
        }
R.T.F.M. means to me, Read The Fantastic Messages.
Make things simple, but don't make simple things simpler!
I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.2.0 Beta