Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2014, 02:27 PM
DreadsUK's Avatar
DreadsUK DreadsUK is offline
 
Join Date: Jan 2014
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do i add this to our forum??

We now have a radio station for our site and i'm wondering which code to add and where.

If i add it to the main page. im concerned it will increase load time. Thought it best to create an article or a separate page. What would you suggest and where and which code do i add.

I've tried it using forum blocks but that means every page refresh stops the music and starts again when loaded

Javascript/HTML scripts


Song title (JS)
Code:
<script type="text/javascript" src="http://shoutcast.mixstream.net/js/song/uk30-free:16392">
You appear to have javascript turned off.
</script>
Number of listeners (JS)
Code:
<script type="text/javascript" src="http://shoutcast.mixstream.net/js/listeners/uk30-free:16392">You appear to have javascript turned off.
Online/Offline (JS)
Code:
<script type="text/javascript" src="http://shoutcast.mixstream.net/js/status/uk30-free:16392">You appear to have javascript turned off.
Online/Offline image (HTML)
Code:
<img src="http://shoutcast.mixstream.net/status/uk30-free:16392.gif" alt="Stream status" width="17" height="17" align="absmiddle">
Display Flash player (Pro Broadcasters Only)
Code:
<script>
	// MixStream Flash Player, http://mixstreamflashplayer.net/ 
	var flashvars = {};flashvars.serverHost = "s30.myradiostream.com:16392/;";flashvars.getStats = "1";flashvars.autoStart = "1";flashvars.textColour = "";flashvars.buttonColour = "";var params = {};params.bgcolor= "";params.wmode="transparent";
</script>
<script type="text/javascript" src="http://mixstreamflashplayer.net/v1.3.js"></script>
PHP scripts
PHP scripts are generally the most reliable and quickest way to get stats from your server. If these don't work then it's probably because either your webhost doesn't support PHP or they have a firewall blocking all outgoing connections, in which case you can either contact them or use the javascripts above.

Song title
Code:
<?php
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) { 
	$title = "Connection timed out or the server is offline  ";
} else { 
	fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
	while (!feof($fp)) {
		$info = fgets($fp);
	}
	$info = str_replace('</body></html>', "", $info);
	$split = explode(',', $info);
	if (empty($split[6])) {
		$title = "The current song is not available  ";
	} else {
		$count = count($split);
		$i = "6";
		while($i<=$count) {
			if ($i > 6) {
				$title .= ", " . $split[$i];
			} else {
				$title .= $split[$i];
			}
			$i++;
		}
	}
}
$title = substr($title, 0, -2);
print $title;
?>
Number of listeners
Code:
<?php
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) { 
	$listeners = "0;";
} else { 
	fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
	while (!feof($fp)) {
		$info = fgets($fp);
	}
	$split = explode(',', $info);
	if ($split[1] == "0") {
		$listeners = "0";
	} else {
		$listeners = $split[0];
	}
}
print $listeners;
?>
Online/Offline
Code:
<?php
// Change these to your online/offline messages //
$online = "Online"; // Displays when stream is online
$offline = "Offline"; // Displays when stream is offline
// don't edit below //
$ip = "s30.myradiostream.com";
$port = "16392";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) { 
	$status = $offline;
} else { 
	fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
	while (!feof($fp)) {
		$info = fgets($fp);
	}
	$split = explode(',', $info);
	if ($split[1] == "0") {
		$status = $offline;
	} else {
		$status = $online;
	}
}
print $status;
?>
Reply With Quote
Reply


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


All times are GMT. The time now is 11:59 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03560 seconds
  • Memory Usage 2,162KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete