Any scripts to show current track/last play tracks?

Steamcast is a stand alone server that combines the features of SHOUTcast and Icecast2 and more to make one mega awesome server.
User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Thu Dec 04, 2014 4:20 am

Ah, yea I see what you are saying now. I don't think that is Steamcast. Looks like how tags are being sent from the source. If it is somehow Steamcast let me know.
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Thu Dec 04, 2014 1:23 pm

Well I downgraded mpd back to the one that comes with Ubuntu server 12.04 and now its working fine and my CPU usage for MPD went down :) will do more testing later today on another box.

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Fri Dec 05, 2014 1:02 am

Ok here it is inserted into my home page http://futureassassin.com sill working on it. Will have more in the next few hours.

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Fri Dec 05, 2014 1:27 am

Looking good! I have a feeling you're going to like some of the features I'm cooking up for the next minor release. :)
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Fri Dec 05, 2014 4:21 pm

Let me just say that I can't code my way out of a wet paper bag but is there a way to split the script into say three sections (Track name, listeners and last played) so that I just print those inside say a div

<div id="current"> <?php current tack code here ?></div>
<div id="listeners"> <?php listeners code here ?></div>
<div id="played"> <?php played code here ?></div>

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Fri Dec 05, 2014 5:22 pm

Sure,

Because the script is just a regular PHP array structure you can place anything you want anywhere on your page.

Code: Select all

<?php
...
$data = $steamcast->stream_info();
if ($data == NULL)
{
  <div id="error">Down for maintenance.</div>
 exit();
}
?>
<div id="current"><?php echo $data['meta_song']; ?></div>
<div id="listeners"><?php echo $data['nodes']; ?></div>
....
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Sat Dec 06, 2014 1:02 pm

Ok got that working but not sure if I structured the code properly but its working :P

Ok now another question. If I have to mounts.

/live and /auto (as fallback) I would use this

$steamcast = new SteamcastStream('http://localhost:8000/', 'admin', 'mysecretpassword');

instead of

$steamcast = new SteamcastStream('http://localhost:8000/auto.ogg', 'admin', 'mysecretpassword');

to shows the info for both mounts?

So when a new source connects to /live the script will show the stream info from the new source?

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Sat Dec 06, 2014 5:47 pm

That is correct additionally you will want:

Code: Select all

...
$live_data = $steamcast->stream_info(0);
$auto_data = $steamcast->stream_info(1);
...
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Wed Dec 10, 2014 1:54 am

Ok I'm gonna see if I can get someone to do this script into a Drupal module.

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Fri Jan 29, 2016 2:11 am

Ok its been a while since I ran this. Can't get the script to connect to the server.

this is what I got for the test file

Code: Select all

<?php
require_once('steamcaststream.php');
$steamcast = new SteamcastStream('http://play.futureassassin.com:8000/auto.mp3', 'admin_user', 'admin_pass');
if ($steamcast->retrieve_stats() && $steamcast->has_streams())
{
   $data = $steamcast->stream_info();
   if ($data != NULL)
   {
      echo 'Wow, '.$data['name'].' has some shtuff in it!  Currently there are '.$data['nodes'].' listeners!  They are currently hearing '.$data['meta_song'].'';

      while (list($key, $val) = each($data['played']))
      {
         echo '<br> at '.date('r', $val['entry_time']).' we played '.$val['song_title'];
      }
      while (list($key, $val) = each($data['peers']))
      {
         echo '<br> '.$val['ip'].' connected at '.date('r', $val['pconnect_time']).' with '.$val['user_agent'];
      }
   }
   else
   {
      echo 'No Mount by this name!';
   }
}
else
{
   echo "This failed :(";
}

?>
In my error lots I get this.

Code: Select all

[Fri Jan 29 02:56:57 2016] [error] [client 69.50.178.27] PHP Notice:  Undefined variable: data in /home/fa/domains/futureassassin.com/public_html/stest.php on line 268
[Fri Jan 29 02:59:20 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 02:59:20 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://ice.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 02:59:29 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 02:59:29 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://ice.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 03:00:50 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 03:02:34 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 03:04:24 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 03:04:28 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
[Fri Jan 29 03:04:29 2016] [error] [client 69.50.178.27] PHP Warning:  file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Fri Jan 29, 2016 2:22 am

Looking at your error log it appears you have it configured to pull from:

http://ice.futureassassin.com:8000/

Which according to my quick check doesn't exist. You will need to adjust the script to pull from play.futureassassin.com:8000
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Fri Jan 29, 2016 2:42 am

Jay wrote:Looking at your error log it appears you have it configured to pull from:

http://ice.futureassassin.com:8000/

Which according to my quick check doesn't exist. You will need to adjust the script to pull from play.futureassassin.com:8000
That was an old log entry. I fixed that right away if you see it say play.future..... in the other log entires. Possible my web host can't see play.futureassassin.com. It would be odd as I have the DNS set on that server.

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Fri Jan 29, 2016 2:54 am

Has play. been changed or modified from a wildcard dns entry recently? Try just putting the IP address directly and see if that resolves it.
- Jay

sound selecta
Posts: 78
Joined: Tue Jan 15, 2002 4:41 am
Location: Vancouver
Contact:

Re: Any scripts to show current track/last play tracks?

Post by sound selecta » Fri Jan 29, 2016 3:11 am

Jay wrote:Has play. been changed or modified from a wildcard dns entry recently? Try just putting the IP address directly and see if that resolves it.
Yah no go. This is what I got for my php version and modules.
php.png

User avatar
Jay
Will work for food (Administrator)
Posts: 2806
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Any scripts to show current track/last play tracks?

Post by Jay » Fri Jan 29, 2016 3:19 am

Hmm, well this is the issue

Code: Select all

file_get_contents(http://play.futureassassin.com:8000/admin/status.json?src=%2Fauto.mp3): failed to open stream: Connection timed out in /home/fa/domains/futureassassin.com/public_html/steamcaststream.php on line 88
Basically what matters here is "Connection timed out", that tells me that something is up with the connection from your webserver to the stream server. It looks like it is completely being blocked. If you are using a shared host provider you might contact them and ask them what their policy is regarding external connections.

Just for a quick test I setup my test script to point to dev.steamcast.com and it still works. Nothing in the code changed. http://www.radiotoolbox.com/steamcast/test.php
- Jay

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest