DJSoft.Net Community Forums

DJSoft.Net => How To Guides => Topic started by: djsoft on March 19, 2018, 08:36:42 AM

Title: [Web site] Song request demo script
Post by: djsoft on March 19, 2018, 08:36:42 AM
RadioBOSS song request script. An example script showing how to implement song requests in RadioBOSS.

User manual page about song requests: https://manual.djsoft.net/radioboss/en/songrequests.htm

How it works
It shows a form with the three fields: artist, title and message. At least one of the fields (artist or title) have to be filled.

The requested song is searched in the music library. If it's found, the request is added to the song request list in RadioBOSS along with the message entered.

It is strongly recommended to have some web programming knowledge in order to install and use this script.

If a script does't work, you can set the $show_errors to 1 to see the detailed error message. Please do not forget to set it back to 0 once the script is deployed.

Update 2019-11-25
Script uses cURL instead of file_get_contents to communicate with RadioBOSS. This allows the script to work on hosts where file_get_contents is not permitted to access URLs.

Code: [Select]
<?php
/*
    RadioBOSS Song Request demo script

    To play the requested songs in RadioBOSS, schedule an event with "playrequestedsong" command:
    http://manual.djsoft.net/radioboss/en/scheduler_commands.htm#songrequest

    Please make sure the RadioBOSS API is enabled and a password is set:
    http://manual.djsoft.net/radioboss/en/remote_controlapi.htm

If RadioBOSS is installed on a server, please make sure the API port (9000 by default) is allowed in firewall.

    Home or studio PC:
If RadioBOSS is installed on a home or studio PC, please make sure it has a static IP address.
    If a static IP address is not available, a Dynamic DNS address has to be used instead
    The IP address (or dynamic DNS address) is entered into the $rb_server variable (please do not include http://)

If a computer is behing a NAT (this is usually the case when a router is used), then API port (9000 by default) has
to be forwarded in router settings - please see the port forwarding documentation for your router.
*/

//---------------//
// CONFIGURATION //
//---------------//
//RadioBOSS API connection details
$rb_server '127.0.0.1'//RadioBOSS hostname or IP
$rb_port '9000'//RadioBOSS port
$rb_password '7bNR5UK'//API password
//music library name, omitting the .xml extension, the library is loaded from "Music library folder" as set in RadioBOSS settings
$rb_library 'music';

//show detailed error messages (1 - show error details, 0 - show only general error messages)
//IMPORTANT! Make sure this is set to 0 once everything is configured and working to avoid revealing too many details to users!
//Error messages may contain passwords and other sensitive information
//Set this to 1 only if something's not working to get more details
$show_errors 0;

//-------------------//
// SONG REQUEST FORM //
//-------------- ----//
//API URL base
$rb_api "http://$rb_server:$rb_port?pass=$rb_password";
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>RadioBOSS Song Request demo</title>
    <style>
        body {
            font-family: Tahoma, sans-serif;
            font-size: 0.8em;
        }
        label {
            display: block;
            margin-bottom: 5pt;
        }
    </style>
</head>
<body>
<?php

$last_err 
''//last HTTPGet error message

function HTTPGet($url) {
    global 
$last_err;
    
$curl curl_init($url);
    
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($curlCURLOPT_HEADERfalse);
    
$res curl_exec($curl);
    if (
$res === false) {
        
$last_err curl_error($curl);
    }
    
curl_close($curl);
    return 
$res;
}

function 
result($msg) {
    
$back_link '<a href="javascript:history.back();">Back</a>';
    exit(
"$msg $back_link");
}

$type = isset($_POST['type']) ? $_POST['type'] : '';
if (
$type === '') {
    echo 
'<form method="post">
            <input type="hidden" name="type" value="request">
            <label>Artist<br><input size="30" name="artist"></label>
            <label>Title<br><input size="30" name="title"></label>
            <label>Message<br><textarea cols="30" rows="3" name="message"></textarea></label>
            <button>Request a song</button>
        </form>'
;
} elseif (
$type === 'request') {
    
//requested artist
    
$artist mb_strtolower(trim($_POST['artist']));
    if (
$artist === '') {
        
$artist false;
    }
    
//requested title
    
$title mb_strtolower(trim($_POST['title']));
    if (
$title === '') {
        
$title false;
    }
    if ((
$artist === false) && ($title === false)) {
        
result('No artist or title entered.');
    }
    
//load library
    
$library_raw HTTPGet("$rb_api&action=library&filename=" urlencode($rb_library));
    if (
$library_raw === false) {
        
$err 'Song request failed: unable to load music library.';
        if (
$show_errors) {
            
$err .= ' Error: ' $last_err;
        }
        
result($err);
    }
    
//parse XML data
    
$xml simplexml_load_string($library_raw);
    if (
$xml === false) {
        
result('Song request failed: unable to parse music library XML data.');
    }
    
$fn false;
    
//search requested song in a music library
    
foreach ($xml as $x) {
        if (
$x->getName() !== 'Track') {
            continue;
        }
        
$found = (($artist === false) || (mb_strtolower((string)$x['artist']) === $artist)) &&
            ((
$title === false) || (mb_strtolower((string)$x['title']) === $title));
        if (
$found) {
            
$fn = (string)$x['filename'];
            break;
        }
    }
    
//song found, add to requested songs list in RadioBOSS
    
if ($fn !== false) {
        
$msg = isset($_POST['message']) ? $_POST['message'] : '';
        
$res HTTPGet("$rb_api&action=songrequest&filename=" urlencode($fn) . '&message=' urlencode($msg));
        if (
$res === 'OK') {
            
result('Song requested successfully!');
        } else {
            
$err 'An error occurred while adding song request.';
            if (
$show_errors) {
                
$err .= ' Error: ' $last_err;
            }
            
result($err);
        }
    } else {
        
result('Requested song not found in the music library.');
    }
}
?>

</body>
</html>
Title: Re: Song request demo script
Post by: viadeskp . on March 30, 2018, 01:24:31 PM
thanks for the contribution, I have a doubt, the code is pasted as is in the example? clear changing the ip the port and the key
Title: Re: Song request demo script
Post by: djsoft on April 02, 2018, 02:21:11 AM
Yes, this is an example. The password is an example too - it won't work anywhere.
Title: Re: Song request demo script
Post by: Sasa Grbic on June 02, 2018, 08:57:49 AM
This script will not work for me. I enabled an API in the RadioBOSS settings, set a password, and all the data entered in the script. I've made a database with a complete music called music.xml. In the script under the database is already written by music. The dynamic dns is working properly, the ip address of the computer on which RadioBOSS is located is located in the DMZ zone on the router. When I open a script on a server and enter the artist name, I get a note that I can not load the database. In the settings at one place, NVDA read \ database \. I guess it's a path to the base. My databases are in appdata \ roaming \ djsoftnet \ radiobossxxx \ database.
Title: Re: Song request demo script
Post by: stokemusic on June 03, 2018, 03:00:40 AM
Yes, I had the same problem, in the end I gave up
Title: Re: Song request demo script
Post by: djsoft on June 04, 2018, 08:10:42 AM
The dynamic dns is working properly, the ip address of the computer on which RadioBOSS is located is located in the DMZ zone on the router. When I open a script on a server and enter the artist name, I get a note that I can not load the database.
Can you please post the exact error message?
Title: Re: Song request demo script
Post by: Sasa Grbic on June 04, 2018, 08:40:06 AM
Code: [Select]
Song request failed: unable to load music library.
Title: Re: Song request demo script
Post by: djsoft on June 04, 2018, 02:20:33 PM
Code: [Select]
Song request failed: unable to load music library.
It appears that either dynamic IP does not work, or song request script is not configured properly. Please try accessing from your browser (change address and port to actual values).
http://address:port?pass=1

It should show you the password is incorrect - that means, the request reached RadioBOSS and was processed. If you see some other error message, then RadioBOSS is inaccessible from internet.
Title: Re: Song request demo script
Post by: Sasa Grbic on June 04, 2018, 04:25:18 PM
It still makes the same mistake.
Title: Re: Song request demo script
Post by: djsoft on June 05, 2018, 05:08:04 AM
What happens when you access http://address:port?pass=1 via web browser?
Title: Re: Song request demo script
Post by: Sasa Grbic on June 05, 2018, 05:34:03 AM
When I entered the web browser http://name.server.com:port/?pass=xxxxxxxxxxxxxxxxx I got the following code:
Code: [Select]
E003: Nothing to do
Title: Re: Song request demo script
Post by: djsoft on June 05, 2018, 10:58:04 AM
Please make sure that you did not include "http" in the server address when configuring a script.

Correct:
$rb_server = 'name.server.com';

Wrong:
$rb_server = 'http://name.server.com';
Title: Re: Song request demo script
Post by: Sasa Grbic on June 05, 2018, 12:31:17 PM
That's how it is set. Http is only in api url.
Title: Re: Song request demo script
Post by: djsoft on June 07, 2018, 02:15:25 PM
It's hard to tell what's wrong. You can send your script to support@djsoft.net, we'll check what could be wrong there. Alternatively, if you are familiar with PHP, you may add some additional error checking to the script to see why it fails.
Title: Re: Song request demo script
Post by: stokemusic on June 10, 2018, 03:03:39 AM
Could a script be incorporated into the next release of RB which could do this automatically if desired?
Title: Re: Song request demo script
Post by: djsoft on June 10, 2018, 06:04:41 AM
Could a script be incorporated into the next release of RB which could do this automatically if desired?
The script has to be installed on your web site, and you can always get the updated version here.
Title: Re: Song request demo script
Post by: stokemusic on June 11, 2018, 03:59:01 AM
yes I understand that. The trouble is the script provided here doesn't seem to work, either for me or anyone else.
Title: Re: Song request demo script
Post by: djsoft on June 11, 2018, 03:25:47 PM
yes I understand that. The trouble is the script provided here doesn't seem to work, either for me or anyone else.
The script is pretty simple and, if configured correctly it will work. You also need to make sure that it's able to communicate with RadioBOSS. If it doesn't work for you, please contact us at support@djsoft.net, and attach the script you use.
Title: Re: Song request demo script
Post by: diabolix on September 24, 2018, 06:06:05 AM

You can make a video demonstration, because I do not know anything and I do not know how it is done, it would be so kind to resign or some soul that understands how it is done, to make a video for those who do not understand how it is done please, thank you
Title: Re: Song request demo script
Post by: djsoft on September 24, 2018, 06:28:12 AM
You can make a video demonstration, because I do not know anything and I do not know how it is done, it would be so kind to resign or some soul that understands how it is done, to make a video for those who do not understand how it is done please, thank you
This requires some (little) web programming knowledge. This topic is huge so it can't be covered here.
The general idea is that you modify access parameters in the script so it connects with your RadioBOSS installation, and then upload the script to your web site. 
Title: Re: Song request demo script
Post by: diabolix on September 24, 2018, 02:25:02 PM
Until then I understand but I do not understand how to do it and I would like some video guide how to do step by step because I have no idea how to do it :(
Title: Re: Song request demo script
Post by: BN-Julian on September 24, 2018, 08:47:03 PM
Please use google and read into coding or ask and pay a coder, if you are not interested in learning the easiest steps to modify code!

This demoscript is a fantastic service of Dmitry and thanks on this way for his fantastic work!
Title: Re: Song request demo script
Post by: djsoft on September 25, 2018, 03:35:45 AM
Until then I understand but I do not understand how to do it and I would like some video guide how to do step by step because I have no idea how to do it :(
Video guide is not possible, the topic is too broad so there's no step by step guide possible as there are lots of ways how web sites are managed. The exact procedure would be different for different web sites. You'll need to obtain some general knowledge of the topic. Or, as BN-Julian suggested, pay someone to do this for you (but still it is advisable to understand how it works).
Title: Re: Song request demo script
Post by: Marcel Märtl on October 15, 2018, 02:05:09 PM
So I inserted the script and now I get this Error-Message:
Quote
Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /var/customers/webs/ni268724_1/wp-content/plugins/insert-php/includes/shortcodes.php(66) : eval()'d code on line 71 Warning: file_get_contents(*******************************&action=library&filename=Datenbank+Musik): failed to open stream: no suitable wrapper could be found in /var/customers/webs/ni268724_1/wp-content/plugins/insert-php/includes/shortcodes.php(66) : eval()'d code on line 71

The Problem is I cant acces my php.ini to enable xml. Is there any workaround?
Title: Re: Song request demo script
Post by: djsoft on October 16, 2018, 02:20:30 AM
The Problem is I cant acces my php.ini to enable xml. Is there any workaround?
I don't think so - this is a requirement for the script to work. You should contact your web host to enable this feature. Or change the host to a less restrictive one.
Title: SONGREQUEST PHP script problem
Post by: NICKY G DJ on November 08, 2018, 09:52:21 AM
hello,
I think the php script "songrequest.php" provided has some problems.
In practice, if I create the complete list manually from the browser, the thing works.

Song request example:

h t t p://192.168.1.106:9001/?pass=JOWHjWTqdH&action=songrequest&filename=C:\Users\XXXX\Desktop\RADIO\AUDIO\MUSIC\elviso%20presley%20-%20trouble.mp3&message=hello%20Elvis

example displays my library:

h t t p://192.168.1.106:9001/?pass=JOWHjWTqdH&action=library&filename=my_music

if I do the request through the form in the PHP script instead, I will return this error

"Song request failed: unable to load music library."

my php file settings:

// details to connect to RadioBOSS API
$ rb_server = '192.168.1.106'; // RadioBOSS hostname (IP)
$ rb_port = '9001'; // RadioBOSS port
$ rb_password = 'JOWHjWTqdH'; // Password API
// music library name (omitting the .xml extension, the library is loaded from
$ rb_library = 'my_music';


where am I wrong? where is the script wrong?

because I manually manage to access my xml list on my computer and through php form I can not access it ?? so I suppose it's the wrong php code !!!
Title: Re: SONGREQUEST PHP script problem
Post by: djsoft on November 09, 2018, 05:23:30 AM
If you have uploaded PHP script to an external server, then the problem could be that 192.168.1.106 is not accessible from there, or that port 9001 is not accessible.

If this is a Windows server, access it via a remote desktop, start a web browser there and see if http://192.168.1.106:9001/?pass=JOWHjWTqdH&action=library&filename=my_music is accessible from there. If browser gives you an error, the script will not work either.
Title: Re: Song request demo script
Post by: djsoft on November 09, 2018, 05:57:01 AM
Song request script updated to include $show_errors configuration option that enables detailed error messages when something's not working, details in the first post and the script itself.
Title: Re: Song request script [The problem is solved]
Post by: NICKY G DJ on November 09, 2018, 12:19:57 PM
in practice I had to:

1. create a Forewarding rule in the router by setting the service port (i.e. 80), local IP (the PC IP) and local port (the one in RB)

2. the php script:
in $ RB_Server put the public IP assigned to my router
in $ RB_Server put service port (80)

3. the php script provided on the site works, but in my case I had to modify it, because I had problems with my altervista.com server because it does not accept the "file_get_contents" statement so I modified the php by changing it with cURL.
Now it works with all web hosting.


------------------------->>> explanations and other ideas <<<

I would like to ask for clarifications and implementations regarding the songrequest function:

1. if this function is used automatically by the seduler, then airing when there is nobody on the radio it can be fine, indeed very well.
But I would like to understand how it could be useful for a live with the speaker who could announce the requested song.

a) practically once I get the requests in RB I display them in the request song panel (ctrl + Y)

b) if I insert a message of very few characters the speaker could read the message and then send the song to the playlist, if the message is long, the song request window (ctrl + Y) makes this reading operation inconvenient.

c) if for example I would like to insert the requested songs into playlists and then the speaker wants to announce the requested song, making the applicant's name and reading the message sent via web form, what happens, when the song request window (ctrl + y ) the song is inserted into playlists for airing, all the information regarding the message sent (which could be hello are mary and I want to dedicate this song to robert because I love it), are lost.

d) I believe that this information should always be available in some way, maybe create a specific TAB in RB (such as a notepad file) where you can set the size of the text and the rarity for easy reading live.
maybe connect with a color highlighting the song on the air required with the message of that song so as to have track that this requested song was associated with that message sent by that listener.


e) I think it is right to insert other fields in the web form which name and surname of who forward the message, this is possible by implementing the php script, but the song request is not enabled to read and show other fields on the screen.
further fields could also be the city of origin, the telephone number and other things that I do not know now.

f) we admit that I have received a list of 100 requests, is it possible to click on the various items to rearrange by artist, title, time of request?
I think that instead of "160 minute ago" better enter the date / time field 09/11/2018 at 18:07 I think it's more practical.

2. expand the PHP script so that there are some fields of research.

author, song, year, genre

For example, through the form I could search within the xml database all the songs of elvis presley, the search shows me that in the list (database) there are 30 songs, near each song I could go out a selection check, then once selected the song below I could fill in other fields such as first name (of the listener requesting the song) and then the message to send ...
so it would be easier and safer to let the artist know which tracks are available in RB

3. another interesting feature for the song request could be this:

The possibility of using a website to make a request for a song, (author - title) and instead of the text message, insert the sending of a voice audio file.

so we admit a seduler song request playlist ....
I could set ...

jingle
      [song request block]
      - posta_vocale.mp3 (voice message of the listener requesting the song)
      - author-titolo.mp3    file

then play the jingle (optional)
first list the file associated with the request received from the website
and then the song file taken from the music library ...

the file with the voice message could be mounted on the intro of the song if sufficiently long, or it starts under a preset base, then fades the base and the song starts and the vocal ending must end on the intro of the requested song.

4. would it be an idea to create a TAB for receiving emails (text only), for the reception of messages to be read on the speaker?
or always a tab that sends messages to RB via web form? (as happens with the reception of messages in the php script for the request of songs, but in this case only and exclusively for text messages.

also for receiving messages via whatsapp (I think Whatsapp does not make this possible), or receiving via telegram etc.





Quote
<?php
/*
    RadioBOSS Song Request demo script

    To play the requested songs in RadioBOSS, schedule an event with "playrequestedsong" command:
    http://manual.djsoft.net/radioboss/en/scheduler_commands.htm#songrequest

    Please make sure the RadioBOSS API is enabled and a password is set:
    http://manual.djsoft.net/radioboss/en/remote_controlapi.htm

   If RadioBOSS is installed on a server, please make sure the API port (9000 by default) is allowed in firewall.

    Home or studio PC:
   If RadioBOSS is installed on a home or studio PC, please make sure it has a static IP address.
    If a static IP address is not available, a Dynamic DNS address has to be used instead
    The IP address (or dynamic DNS address) is entered into the $rb_server variable (please do not include http://)
   
   If a computer is behing a NAT (this is usually the case when a router is used), then API port (9000 by default) has
   to be forwarded in router settings - see port forwarding documentation for your router.
*/

//---------------//
// CONFIGURATION //
//---------------//
//RadioBOSS API connection details
$rb_server = '95.xxx.xxx.xxx'; //RadioBOSS hostname or IP
$rb_port = '80'; //RadioBOSS port
$rb_password = 'YdVdfWTqdH'; //API password
//music library name, omitting the .xml extension, the library is loaded from "Music library folder" as set in RadioBOSS settings
$rb_library = 'my_library_music';


//show detailed error messages (1 - show error details, 0 - show only general error messages)
//IMPORTANT! Make sure this is set to 0 once everything is configured and working to avoid revealing too many details to users!
//Error messages may contain passwords and other sensitive information
//Set this to 1 only if something's not working to get more details
$show_errors = 0;

//-------------------//
// SONG REQUEST FORM //
//-------------- ----//
//API URL base
$rb_api = "http://$rb_server:$rb_port?pass=$rb_password";

function result($msg) {
    $back_link = '<a href="javascript:history.back();">Back</a>';
    exit("$msg $back_link");
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>RadioBOSS Song Request demo</title>
    <style>
        body {
            font-family: Tahoma, sans-serif;
            font-size: 0.8em;
        }
        label {
            display: block;
            margin-bottom: 5pt;
        }
    </style>
</head>
<body>
<?php
    $type = isset($_POST['type']) ? $_POST['type'] : '';
    if ($type === '') {
        echo '<form method="post">
            <input type="hidden" name="type" value="request">
            <label>Artist<br><input size="30" name="artist"></label>
            <label>Title<br><input size="30" name="title"></label>
            <label>Message<br><textarea cols="30" rows="3" name="message" maxlength="13"></textarea></label>
            <button>Request a song</button>
        </form>';
    } elseif ($type === 'request') {
        //requested artist
        $artist = mb_strtolower(trim($_POST['artist']));
        if ($artist === '')
            $artist = false;
        //requested title
        $title = mb_strtolower(trim($_POST['title']));
        if ($title === '')
            $title = false;
        if (($artist === false) && ($title === false))
            result('No artist or title entered.');
      
         //Start Original Code (No Altervista)
               //load library
               //$library_raw = @file_get_contents("$rb_api&action=library&filename=" . urlencode($rb_library));
               //if ($library_raw === false) {
               //    $err = 'Song request failed: unable to load music library.';
               //    if ($show_errors)
               //        $err .= ' Error: ' . error_get_last()['message'];
               //    result($err);
               // }
         //End Original Code (No Altervista)
         
         
         //Start of MyCode (Si Altervista)
         //load library
                  // Get cURL resource
                  $curl = curl_init();
                  // Set some options - we are passing in a useragent too here
                  curl_setopt_array($curl, array(
                     CURLOPT_RETURNTRANSFER => 1,
                     CURLOPT_URL => "$rb_api&action=library&filename=" . urlencode($rb_library),
                     CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
                  ));
                  // Send the request & save response to $resp
                  $library_raw = curl_exec($curl);
                  // Close request to clear up some resources
                  curl_close($curl);
               
                  echo $library_raw;
         //End of MyCode (Si Altervista)
      
      if ($library_raw === false) {
           $err = 'Song request failed: unable to load music library.';
           if ($show_errors)
               $err .= ' Error: ' . error_get_last()['message'];
           result($err);
        } 
      
        //parse XML data
        $xml = simplexml_load_string($library_raw);
        if ($xml === false)
            result('Song request failed: unable to parse music library XML data.');
        $fn = false;
        //search requested song in a music library
        foreach ($xml as $x) {
            if ($x->getName() !== 'Track')
                continue;
            $found = (($artist === false) || (mb_strtolower((string)$x['artist']) === $artist)) &&
                (($title === false) || (mb_strtolower((string)$x['title']) === $title));
            if ($found) {
                $fn = (string)$x['filename'];
                break;
            }
        }
        //song found, add to requested songs list in RadioBOSS
        if ($fn !== false) {
            $msg = isset($_POST['message']) ? $_POST['message'] : '';
            $res = @file_get_contents("$rb_api&action=songrequest&filename=" . urlencode($fn) . "&message=" . urlencode($msg));
            if ($res === "OK")
                result('Song requested successfully!');
            else {
                $err = 'An error occurred while adding song request.';
                if ($show_errors)
                    $err .= ' Error: ' . error_get_last()['message'];
                result($err);
            }
        }
        else
            result('Requested song not found in the music library.');
    }
?>
</body>
</html>

Title: Re: Song request demo script
Post by: djsoft on November 10, 2018, 03:41:26 PM
3. the php script provided on the site works, but in my case I had to modify it, because I had problems with my altervista.com server because it does not accept the "file_get_contents" statement so I modified the php by changing it with cURL.
Now it works with all web hosting.
Except those that do not support cURL :) It is a good addition, and we'll add the cURL option (configurable) to the demo script as well.

But I would like to understand how it could be useful for a live with the speaker who could announce the requested song.
You can open the requests window and use the "To player" button to insert the songs to the playlist manually.

b) if I insert a message of very few characters the speaker could read the message and then send the song to the playlist, if the message is long, the song request window (ctrl + Y) makes this reading operation inconvenient.

c) if for example I would like to insert the requested songs into playlists and then the speaker wants to announce the requested song, making the applicant's name and reading the message sent via web form, what happens, when the song request window (ctrl + y ) the song is inserted into playlists for airing, all the information regarding the message sent (which could be hello are mary and I want to dedicate this song to robert because I love it), are lost.

d) I believe that this information should always be available in some way, maybe create a specific TAB in RB (such as a notepad file) where you can set the size of the text and the rarity for easy reading live.
maybe connect with a color highlighting the song on the air required with the message of that song so as to have track that this requested song was associated with that message sent by that listener.

Thank you for the suggestions, we'll consider adding those improvements. It will certainly be possible to read long messages.

e) I think it is right to insert other fields in the web form which name and surname of who forward the message, this is possible by implementing the php script, but the song request is not enabled to read and show other fields on the screen.
further fields could also be the city of origin, the telephone number and other things that I do not know now.
This should be done by your script, and the info can be inserted into the "message".
Title: Re: Song request demo script
Post by: djsoft on November 10, 2018, 03:43:48 PM
2. expand the PHP script so that there are some fields of research.

author, song, year, genre

For example, through the form I could search within the xml database all the songs of elvis presley, the search shows me that in the list (database) there are 30 songs, near each song I could go out a selection check, then once selected the song below I could fill in other fields such as first name (of the listener requesting the song) and then the message to send ...
so it would be easier and safer to let the artist know which tracks are available in RB

3. another interesting feature for the song request could be this:

The possibility of using a website to make a request for a song, (author - title) and instead of the text message, insert the sending of a voice audio file.
All this can be done on a web site, using the scripts - as you can get the full library from RadioBOSS, you can perform any kind of searches on it. As for inserting audio files, this is also possible using RadioBOSS API.
Title: Re: Song request demo script
Post by: NICKY G DJ on November 10, 2018, 04:10:58 PM
RadioBOSS API

how is it possible via RB API to send a voice file to the direction and put it in the queue before the requested song ???
Title: Re: Song request demo script
Post by: djsoft on November 11, 2018, 03:27:30 PM
how is it possible via RB API to send a voice file to the direction and put it in the queue before the requested song
Currently it is not possible to upload files using the API - you can only insert at a defined position. I'm sorry for misinformation
Title: Re: Song request demo script
Post by: NICKY G DJ on November 11, 2018, 03:53:03 PM
how is it possible via RB API to send a voice file to the direction and put it in the queue before the requested song
Currently it is not possible to upload files using the API - you can only insert at a defined position. I'm sorry for misinformation

I think it's a nice implementation for dedications with messages on demand (to be operated in total autonomy)
Title: Re: Song request demo script
Post by: djsoft on November 12, 2018, 04:31:36 AM
I think it's a nice implementation for dedications with messages on demand (to be operated in total autonomy)
The uploaded audio files have to be moderated as users can upload anything like offensive language or something like this.
Title: Re: Song request demo script
Post by: Boszor on January 13, 2019, 04:04:02 AM
Hello there is a possibility synonymous to play a message via TTS?
Title: Re: Song request demo script
Post by: djsoft on January 13, 2019, 04:30:43 AM
Hello there is a possibility synonymous to play a message via TTS?
Currently this is not possible. Also, what if a user writes something offensive in it?
Title: Re: Song request demo script
Post by: Boszor on January 13, 2019, 04:35:12 AM
For this one could create a filter list beforehand, which filters out these words.

Is there a way to announce the song request event with a previous jinggle? My attempts have always failed miserably. Either he did not accept the command anymore or if I let it run directly through the script I only took one song out of the request. Can one also say that the song request is read out completely automatically in a timeframe and not just 1 song.
Title: Re: Song request demo script
Post by: djsoft on January 14, 2019, 04:46:11 AM
Currently I don't think there's a way to do it fully automatically, I'm sorry.
Title: Re: Song request demo script
Post by: bfmradio on August 24, 2019, 05:38:48 PM


Hi

Works great!

At first it did not work.  There was same error that was described in the beginning of this topic.

The problem was that some hosting providers BLOCK some ports.   The minute port was unblocked, all started to work just great!

I have a question, however:

Is it possible to apply some filters for listeners:

number of allowed requests per hour and no more than X requests per day (ip based)

Is there a way to make a way for listeners to search for a song before they request it?

Thanks.



Title: Re: Song request demo script
Post by: djsoft on August 26, 2019, 02:42:43 AM
Is it possible to apply some filters for listeners:

number of allowed requests per hour and no more than X requests per day (ip based)

Is there a way to make a way for listeners to search for a song before they request it?
Everything is possible - this script is just an example, and only has the basic features. You can add whatever new features you need to it.
Title: Re: [Web site] Song request demo script
Post by: djsoft on November 25, 2019, 06:41:56 AM
Song request script was updates. Now it uses cURL instead of file_get_contents to communicate with RadioBOSS. This allows the script to work on hosts where file_get_contents is not permitted to access URLs.