Any scripts to show current track/last play tracks?
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
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
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
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.
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
Ok here it is inserted into my home page http://futureassassin.com sill working on it. Will have more in the next few hours.
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
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
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
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>
<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>
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
Sure,
Because the script is just a regular PHP array structure you can place anything you want anywhere on your page.
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
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
Ok got that working but not sure if I structured the code properly but its working
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?
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?
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
That is correct additionally you will want:
Code: Select all
...
$live_data = $steamcast->stream_info(0);
$auto_data = $steamcast->stream_info(1);
...
- Jay
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
Ok I'm gonna see if I can get someone to do this script into a Drupal module.
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
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
In my error lots I get this.
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 :(";
}
?>
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
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
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
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
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
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.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
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
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
-
- Posts: 78
- Joined: Tue Jan 15, 2002 4:41 am
- Location: Vancouver
- Contact:
Re: Any scripts to show current track/last play tracks?
Yah no go. This is what I got for my php version and modules.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.
- Jay
- Will work for food (Administrator)
- Posts: 3025
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
Re: Any scripts to show current track/last play tracks?
Hmm, well this is the issue
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
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
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