DJSoft.Net Community Forums

DJSoft.Net => How To Guides => Topic started by: djsoft on November 25, 2019, 05:15:14 AM

Title: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on November 25, 2019, 05:15:14 AM
The script will show currently playing track title along with its cover art. Also shows recently played tracks.

How to use

1. Install the script on your web site
Download the attached nowplaying.zip and upload files from the archive to your web site. Files must be uploaded to a folder accessible publicly from the web - e.g. public_html, www.

2. Create HTTP request in RadioBOSS
- Open the Settings window, navigate to Reports
- Check the Enable notifications checkbox
- Enable the Save artwork option to make RadioBOSS export the artwork information (otherwise the %artwork variable used in the HTTP request will not work)
- Add new request using the + button and enter the following URL (replace the web site address)
Code: [Select]
http://www.yoursite.com/nowplaying.php?artist=%artist&title=%title&artwork=%artwork&key=TB21Dr3km- Change the Method to POST.

Please see this link for more info about using notifications in RadioBOSS: https://manual.djsoft.net/radioboss/en/http_request.htm

3. See it in action
Start playback in RadioBOSS to make it send the playing track info to the script.
Navigate to http://www.yoursite.com/nowplaying.html you should see the title and album cover displayed (see the image attached).
The nowplaying.html is an example on how the data is displayed. You can copy parts from it to your real web site pages to display the data where needed.

Security
Once everything works, change the script access key ($key) in nowplaying.php and enter the new access key in HTTP request in RadioBOSS (the &key= parameter in the URL).
Access key makes sure that only allowed requests will come through.

Troubleshooting
If you see error 500 in RadioBOSS with message like "Failed to write to a file", it probably means the script does not have permission to save data to files. You should allow write permission for the following files:
- nowplaying_artwork.png
- nowplaying_title.txt
mode 666 should work, you can also try 755 or 777.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: jopara on November 26, 2019, 01:20:46 PM
Hello again.
I'm trying this new script and it's great to insert the coverart of our musical themes. Now, I would like to make some considerations.
1.- It is good to be able to add your own coverart to each musical theme (tired, but it can be done little by little). Now, is it possible to do it automatically? It is interesting for coverart that do not contain, put the logo. Well with the option that is already enabled or to each audio track separately.
2.- Interesting to have the songs that have sounded, but why not also add the ones that will sound?
Thank you
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on November 27, 2019, 07:38:35 AM
1.- It is good to be able to add your own coverart to each musical theme (tired, but it can be done little by little). Now, is it possible to do it automatically? It is interesting for coverart that do not contain, put the logo. Well with the option that is already enabled or to each audio track separately.
It is possible to use the default cover art, in RadioBOSS  5.9 it is configured in Settings->Reports->Default artwork. It will use this artwork for tracks that do not have artwork.

2.- Interesting to have the songs that have sounded, but why not also add the ones that will sound?
RadioBOSS only knows the next track and it does not process the playlist further than that. It will only be possible to display the next track title (with little script addition). But there is a problem involved: this way, it will also announce jingles and other items as well (the next track does not perform filtering).
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: BFM on November 30, 2019, 12:18:20 PM
Hi,

Is it possible to edit this script that would display only one title of the next song?  Since i saw it through the API function it is possible to display artwork of the next song (ACTION: nexttrackartworkbut) but there are nowhere to display the title of the next song, so this turns out to be useless!

Quote
RadioBOSS only knows the next track and it does not process the playlist further than that. It will only be possible to display the next track title (with little script addition). But there is a problem involved: this way, it will also announce jingles and other items as well (the next track does not perform filtering).
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on December 01, 2019, 05:13:38 AM
This script does not use the API, it uses nowplaying notifications: https://manual.djsoft.net/radioboss/en/http_request.htm

You can extend it to include the next song information, add parameter to the request, e.g. &next=%nextsong then read and display $_REQUEST['next'] in the script, similar to how it treats artist/title.

If you use the API, next track information is included in playbackinfo.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: BFM on December 01, 2019, 05:19:01 AM
You can extend it to include the next song information, add parameter to the request, e.g. &next=%nextsong then read and display $_REQUEST['next'] in the script, similar to how it treats artist/title.

Will that prevent jingles from appearing instead of song names??
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: BFM on December 01, 2019, 06:11:17 AM
I added this in php script:
Code: [Select]
$max_next = 1;
$nextsong = $_REQUEST['next'];
$n = htmlspecialchars($nextsong);
$file2 = 'nextplaying.txt';

$next = file($file2, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$next = array_slice($next, 0, $max_next);

$r2 = fopen($file2, 'wb');
if ($r2 !== false) {
    fwrite($r2, $n . "\n");
    foreach ($next as $s2) {
        fwrite($r2, $s2 . "\n");
    }
    fclose($r2);
} else {
    ReturnError(500, 'Failed to write title to a file');
}

But in nextplaying.txt I only received %nextsong?  I also added in the link &next=%nextsong&key=.. What's wrong?
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on December 01, 2019, 08:07:14 AM
But in nextplaying.txt I only received %nextsong?  I also added in the link &next=%nextsong&key=.. What's wrong?
Please try updating to RadioBOSS 5.9.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: DJ Denise on February 12, 2020, 03:10:15 PM
Hi BFM,  what privileges does this need on a host server please. I looks like you need to be able to write to the web server  and run active server pages so it would require writable access to the server?
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: jopara on March 02, 2020, 03:10:16 PM
Hi.
Now, I have a delay in the straming server of about ten seconds with respect to the broadcast, with which the cover and the title / artist come out before it starts playing in the reproducer.
Is it possible to match the beginning of the song with the cover and the title / artist?
Thank you
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on March 04, 2020, 06:19:45 AM
Now, I have a delay in the straming server of about ten seconds with respect to the broadcast, with which the cover and the title / artist come out before it starts playing in the reproducer.
Is it possible to match the beginning of the song with the cover and the title / artist?
Currently this is not supported, I'm sorry. If you're familiar with PHP programming language, you can try introducing a delay in the script.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: zacgu on March 16, 2020, 05:47:59 PM
I keep getting this error: HTTP Request (#3) error: HTTP/1.1 503 Service Unavailable. Also where do I change Method to POST? Please advise. Thank you
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: zacgu on March 17, 2020, 04:46:03 AM
Okay, got it working. Except for the artwork. Went through all the permissions settings. Any ideas?  :-\
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on March 18, 2020, 04:10:59 AM
You need to use RadioBOSS 5.9 or newer and switch HTTP request method to POST, the option does not exist in the older versions and without it artwork will not work.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: zacgu on March 18, 2020, 06:52:47 AM
Got it. Than you
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: DJ Denise on April 10, 2020, 06:52:52 AM
I must be doing something wrong  created a somee website and added the files from the zip to its newly created website. deniserose.somee.com/

It seems not to transfer the graphic image or the track info Radioboss 5.9.30 is set in options reports to  www.deniserose.somee.com/nowplaying.php?artist=%artist&title=%title&artwork=%artwork&key=TB21Dr3km as below

https://gyazo.com/4e04807deb3b699890d36e8cd6af5fb2
(https://gyazo.com/4e04807deb3b699890d36e8cd6af5fb2.png)

My page is returned as follows:
https://gyazo.com/4ff3374a401ab78896ef9dffe26d0c15
(https://gyazo.com/4ff3374a401ab78896ef9dffe26d0c15.png)

Does anyone know why please? As i get no error! its runing on aSP 4.0- 4.8  but i can run it on Nectcore 2.2 or 2.0, 3.0, 3.5 any ideas please?

When I run the link for the register of the data www.deniserose.somee.com/nowplaying.php?artist=%artist&title=%title&artwork=%artwork&key=TB21Dr3km i recieve and error HTTP Error 404.3

Thanks for looking Denise?
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on April 10, 2020, 11:20:54 AM
When I run the link for the register of the data www.deniserose.somee.com/nowplaying.php?artist=%artist&title=%title&artwork=%artwork&key=TB21Dr3km i recieve and error HTTP Error 404.3
This explains why it doesn't work - the file is not found. Also make sure that the server where you have uploaoded it supports PHP.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: DJ Denise on April 10, 2020, 03:02:13 PM
Hi there thanks so much for your answer. I have tried with another provider and can get %artist-%Title into the file I just cant seem to get the output to trigger from Radio Boss . Do I need the event-logger or other part cant remember the name  that logs the music being played to get the report service to work please? I think the other provider is not running php
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on April 11, 2020, 03:32:55 AM
The first post describes all the steps you need to to to make it work. If it still doesn't work you should diagnnose what fails, e.g. check the temporary file if it actually contains track title, check if there are error messages in RadioBOSS when it sends track info etc.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: DJ Denise on April 12, 2020, 04:34:35 AM
Thanks noted have it working:D
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: Slovenski Narodnjak on May 25, 2020, 05:56:14 AM
Hellppp! Error
Unable to find installation package
https://www.djsoft.net/smf/index.php?action=dlattach;topic=6352.0;attach=10010
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: djsoft on May 27, 2020, 03:45:37 AM
The link is working here.
Title: Re: [Web site] Show current track title, cover art, recent tracks
Post by: DJ Denise on June 27, 2020, 05:01:17 AM
I can assure you all the song art work is working fantastically and i love it :)