Old 4th August 2018, 11:19   #1
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Display playlist info from my stream on my web site

I have a stream. It runs off a simple playlist. it's 3000 items long, and each item is minimum 30 minutes long, maximum 90 minutes, so it's a playlist that takes a long time to repeat- over two months.

I would like to put some code on my website that would display where in the playlist the currently streaming track is, what's coming next, and maybe even the next 10 playlist items. (My material is all public domain so there's no problem with letting folks know what's coming up next)

I know I can just show the HTML output of the DNAS which shows the next track, but I want something nicer than that- something that shows more.

Before I go about re-inventing a wheel that someone may have already created, I thought I'd ask - anyone know of such a thing?

Thanks
milosz is offline   Reply With Quote
Old 4th August 2018, 11:29   #2
NJK
FRYSK BLOED TSJOCH OP- FRISIAN
 
NJK's Avatar
 
Join Date: Sep 2003
Location: a real Frisian hometown
Posts: 15,536
I take it you search the internet already for Now Playing Scripts?

Each Thursday a new show on Celtica Radio with Darkwave music.

WINAMPSHOUTCAST
NJK is offline   Reply With Quote
Old 4th August 2018, 12:13   #3
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
I don't need a "now playing" - I have one of those already - I need a "next ten to be played"

Various searches for shoutcast scripts, stream scripts etc have not found any "upcoming tracks" scripts

Thanks
milosz is offline   Reply With Quote
Old 4th August 2018, 12:27   #4
NJK
FRYSK BLOED TSJOCH OP- FRISIAN
 
NJK's Avatar
 
Join Date: Sep 2003
Location: a real Frisian hometown
Posts: 15,536
https://www.youtube.com/watch?v=ppzYGd0wi_c

https://www.youtube.com/watch?v=HtTG5Kf_mTA

https://github.com/AzuraCast/AzuraCast/issues/158

just 3 examples of what you might be needing.

Each Thursday a new show on Celtica Radio with Darkwave music.

WINAMPSHOUTCAST
NJK is offline   Reply With Quote
Old 4th August 2018, 22:15   #5
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Thanks. The database / PHP stuff would be useful if / when I do my own script. My playlist is not a database, just a flat file, but the approach could probably be made to work. I think there would be more work, too, because the script would have to get the "now playing" info from the DNAS.

The recently played / now playing / what's next info is already easily available from the DNAS' HTTP output which I could put in a frame or some such.

What I am looking for is something to show the next 10 upcoming tracks, and that doesn't seem to exist. Perhaps I'll have to do that myself.... but it was worth a shout out to see if someone had already done it, after my various searches didn't turn it up.

If I get it to work I'll post it.
milosz is offline   Reply With Quote
Old 11th January 2019, 07:50   #6
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
...no luck so far...
milosz is offline   Reply With Quote
Old 11th January 2019, 08:01   #7
joshpratt
Junior Member
 
Join Date: Jan 2019
Posts: 2
Quote:
Originally Posted by milosz View Post
I have a stream. It runs off a simple playlist. it's 3000 items long, and each item is minimum 30 minutes long, maximum 90 minutes, so it's a playlist that takes a long time to repeat- over two months.

I would like to put some code on my website that would display where in the playlist the currently streaming track is, what's coming next, and maybe even the next 10 playlist items. (My material is all public domain so there's no problem with letting folks know what's coming up next)

I know I can just show the HTML showbox apk output of the DNAS which shows the next track, but I want something nicer than that- something that shows more.

Before I go about re-inventing a wheel that someone may have already created, I thought I'd ask - anyone know of such a thing?

Thanks
Did anyone fix this issue?
joshpratt is offline   Reply With Quote
Old 11th January 2019, 08:03   #8
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
No one has offered any solutions; it is left up to me to code one. So far I haven't had the time required to tackle this.
milosz is offline   Reply With Quote
Old 29th January 2019, 11:56   #9
harrygeorge4158
Banned
 
Join Date: Jan 2019
Posts: 1
Free Shoutcast and Icecast Flash or HTML5 Player. Streak Player with the decision of an extraordinary skin. MP3 design just, Icecast servers utilize the/stream mount, alter ...
harrygeorge4158 is offline   Reply With Quote
Old 29th January 2019, 16:57   #10
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
I don't understand that reply, sorry.
milosz is offline   Reply With Quote
Old 29th January 2019, 17:42   #11
neralex
Major Dude
 
Join Date: Mar 2011
Posts: 576
milosz, this is possible in DNASv2 but only with a source, which is supporting the SHOUTcast v2 protocol and this source must be able to provide this information. From all what I know - sc_trans (deprecated, unsupported anymore, still BETA) was the only one source-manger, which was able to do this.

http://wiki.winamp.com/wiki/SHOUTcas...nses#Nextsongs
neralex is offline   Reply With Quote
Old 29th January 2019, 18:09   #12
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Well, I am using sc_trans. How about that, I never saw this/nextsongs thing.

And I can embed the [http://server IP: port/nextsongs output in my website. HTML5 embed is maybe not the best way to use it, but it DOES work.
milosz is offline   Reply With Quote
Old 29th January 2019, 19:46   #13
neralex
Major Dude
 
Join Date: Mar 2011
Posts: 576
Parse the XML-data with PHP or use the JSONP callback with a jQuery/ajax request.

/nextsongs?sid=1&json=1
neralex is offline   Reply With Quote
Old 31st January 2019, 00:43   #14
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Thanks neralex. That IS the way forward.

I am running into CORS issues with this approach though, DNAS doesn't support CORS as far as I can tell, seems I will have to implement an apache reverse-proxy on the machine to get this to work.

Or maybe I am just confused.
milosz is offline   Reply With Quote
Old 1st March 2019, 02:47   #15
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
I'm a little late, but if you haven't gotten this solved yet, I used JSONP to get around the CORS issue
stereoscenic is offline   Reply With Quote
Old 1st March 2019, 07:24   #16
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Jsonp -

JSONP can get around CORS. I'm looking into this. Don't know yet how to implement. Looking at it.

**THANKS!!**
milosz is offline   Reply With Quote
Old 1st March 2019, 15:26   #17
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
Here's how I do it for now playing & listener count:

<script>
var np = {};
np.parse = function(r){

var t = r.streams[3].songtitle.split(" - ");
document.getElementById('trackartist').innerHTML = t[0];
document.getElementById('tracktitle').innerHTML = t[1];
document.getElementById('nolisteners').innerHTML = (r.streams[2].currentlisteners + r.streams[3].currentlisteners) + ' <div id=listeners-label>Listeners</div>';

}
np.jsonp = function(){
var s = document.createElement("script");
s.src="http://yourserver.com/statistics?json=1&callback=np.parse";
document.body.appendChild(s);
document.body.removeChild(s);
setTimeout( function(){ window.requestAnimationFrame( np.jsonp ) || np.jsonp(); }, 3e4 );
}
np.jsonp();
// setInterval(np.jsonp, 3e4);
</script>

Note: this checks the server every 30 seconds. I use "requestanimationframe" to pause the script when the browser has a different tab active. you could remove that whole line and use the basic "setInterval" method at the end there.
stereoscenic is offline   Reply With Quote
Old 1st March 2019, 23:06   #18
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
I will try something like that.

Stereoscenic, is your web server on the same machine as the stream server?
milosz is offline   Reply With Quote
Old 1st March 2019, 23:15   #19
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
No, it's a different server.
stereoscenic is offline   Reply With Quote
Old 1st March 2019, 23:32   #20
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
OK, so is mine.

I'm not much good at javascript or php. I can struggle through using an example that someone else provides and adapting it to my use. There are also a couple of guys who code for a living that sometimes provide me with adult supervision.

I'm going to give this a try before long, when I have some quiet time late at night.

Thanks
milosz is offline   Reply With Quote
Old 1st March 2019, 23:35   #21
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
Shoot me any questions you may have, happy to help.
stereoscenic is offline   Reply With Quote
Old 2nd March 2019, 00:08   #22
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Thanks! I'm sure I'll have some.
milosz is offline   Reply With Quote
Old 13th March 2019, 00:07   #23
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
Here it is!!!!

This works - putting this script and tags in the body of my web site shows the upcoming tracks

<script>
var np = {};
np.parse = function(r){

var titles = document.getElementById('titles');
var innerHtml = "";
for(var i = 0; i < r.length; i++){
innerHtml += "<div>" + r[i].title + "</div>"
}
titles.innerHTML=innerHtml;

}
np.jsonp = function(){
var s = document.createElement("script");
s.src="http://MYSTREAMADDRESS:PORTNUMBER/nextsongs?sid=1&json=1&callback=np.parse";
document.body.appendChild(s);
document.body.removeChild(s);
setTimeout( function(){ window.requestAnimationFrame( np.jsonp ) || np.jsonp(); }, 3e4 );
}
np.jsonp();
// setInterval(np.jsonp, 3e4);
</script>

<div align="center">
<div CLASS="para2" align="right"></div>
</div>
<p></p>
<div id="titles">title</div>


=====================================

Many thanks for pointing me to the syntax for &callback that's what was needed to get around the CORS thing
milosz is offline   Reply With Quote
Old 13th March 2019, 05:13   #24
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
awesome! glad you got it worked out. It seems like such a hacky way of doing things, but I don't know if there's anything better
stereoscenic is offline   Reply With Quote
Old 13th March 2019, 05:21   #25
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
It works

The important thing is IT WORKS, and this method even updates the web page in real time more or less.

All based on the direction you provided, sir! MANY THANKS.
milosz is offline   Reply With Quote
Old 13th March 2019, 05:29   #26
stereoscenic
Junior Member
 
Join Date: Dec 2013
Posts: 18
Oh hey that reminds me, you can reduce the time between updates. In case you didn't know, the "3e4" is just another way of writing 30000 for milliseconds (because every character counts, lol)
stereoscenic is offline   Reply With Quote
Old 17th March 2020, 22:54   #27
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
There is an issue with getting a page with this code in it to display the results on browsers which now enforce greater security, you can work around this by telling the browser in it's settings that the specific page should be allowed.

I know this is old stuff, sc_trans is old, unsupported and not the greatest to begin with - but in many cases sc_trans DOES WORK and is super easy to implement. So easy to implement on things like Ubuntu 14.04 with a simple playlist type stream.

My listeners really like this "Upcoming tracks" feature.
milosz is offline   Reply With Quote
Old 7th February 2021, 05:19   #28
dimbslmh
Junior Member
 
Join Date: Aug 2014
Posts: 4
We are currently using AutoDJ, but it only displays 1 title on the /nextsongs page.

I am having trouble finding documentation about sc_trans and it's support of nextsongs.

How did you get to display more then 1 title?
dimbslmh is offline   Reply With Quote
Old 7th February 2021, 09:16   #29
milosz
Senior Member
 
Join Date: Apr 2006
Location: chicago
Posts: 126
List of upcoming tracks

If you call

http://<IP Address or URL>:<PORT NUMBER FOR SHOUTCAST - USUALLY 8000)/nextsongs?sid=<SID NUMBER OF THE STREAM TO SHOW UPCOMING TRACKS>

For example, to see the XML containing the next tracks for my stream: http://streams.audionoir.com:8000/nextsongs?sid=1



sc_trans will output XML containing the next 10 tracks in the playlist. Using javascript and
AJAX on your web page you must then parse this XML into a list you can display on the site.

CAVEAT: because this involves cross-origin resource sharing (CORS) Google Chrome will block the parsed output and it will not show up on your web site. The user can often invoke a workaround, but it's not elegant to ask your listeners to enable a workaround in order to see some feature on your stream's web site.

There's some more info about this here=>https://developer.chrome.com/docs/extensions/mv2/xhr/
milosz is offline   Reply With Quote
Old 8th February 2021, 08:08   #30
dimbslmh
Junior Member
 
Join Date: Aug 2014
Posts: 4
You can also request it as JSON directly by adding &json=true
See: http://streams.audionoir.com:8000/ne...id=1&json=true

Because we use Centova, we are experiencing this problem: https://centova.com/forums/index.php?topic=2152.0

Thanks milosz for the reply.
dimbslmh is offline   Reply With Quote
Old 28th February 2021, 08:24   #31
slimmans
Junior Member
 
Join Date: Feb 2021
Posts: 1
Can't see next songs

Hi,

Your help is appreciated

I can't see the list of 10 next songs for my radio station:
code:
http://51.83.16.212:8080/nextsongs?sid=1


can see only One next:

code:
http://51.83.16.212:8080/nextsong


(I am using winamp 5.8 and Shoutcast DSP 2.3.5)
any ideas??

Thanks
slimmans is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump