Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » Joomla »

A ver si podeis ayudarme con un modulo stream

Estas en el tema de A ver si podeis ayudarme con un modulo stream en el foro de Joomla en Foros del Web. Pues eso he estado cambiando el modulo de stream, para poder ponerlo en mi web, para que me detecte, los stream online me los muestre. ...
  #1 (permalink)  
Antiguo 17/09/2013, 08:50
Avatar de rhasert  
Fecha de Ingreso: febrero-2008
Mensajes: 47
Antigüedad: 16 años, 2 meses
Puntos: 0
A ver si podeis ayudarme con un modulo stream

Pues eso he estado cambiando el modulo de stream, para poder ponerlo en mi web, para que me detecte, los stream online me los muestre.

Pero tengo un problema, y es que la url que quiero cambiarla para que no mande a la web de twitch.tv. Si no que me mande a un articulo que yo cree, que dependiendo de la variable, o lo que sea, me muestre un articulo con el stream de ese jugador y lo que yo ponga, no se si me explico.

El codigo que estoy cambiando es este:

Código:
<?php
echo '<b>StarCraft: Brood War</b> &nbsp; </br>';	
	defined('_JEXEC') or die('Direct access to this location is not allowed.');
	
	
	//get's the comma seperated list from the module manager page
	$userList = $params->get('userlist');
	
// This variable becomes one long url with the channel names stringed up behind it
// This url then fetches a json file from twitch with all the selected channels information
	$usersArray = explode(',', $userList);
	
//grabs the channel data from twitch.tv streams	
	$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
	$checkedOnline = array ();
	
		
//creates a url for retrieving the twitch json file for our selected users
	foreach($usersArray as $i =>$value){
		$userGrab .= ",";
		$userGrab .= $value;
	}
	unset($value); 
	
//grabs the channel data from our teams twitch.tv streams using the $userGrab url
	$json_file = file_get_contents($userGrab, 0, null, null);

//decodes the jason file and turns it into an array
	$json_array = json_decode($json_file, true);
	
//get's member names from stream url's and checks for online usersArray
	foreach($usersArray as $i =>$value){
		$title = $json_array[$i]['channel']['channel_url'];
		$array = explode('/', $title);
		$member = end($array);
		$viewer = $json_array[$i]['stream_count'];
		$topic = $json_array[$i]['title'];
		onlinecheck($member, $viewer, $topic);
		$checkedOnline[] = signin($member);
	}

	unset($value);
	unset($i);

//checks if player streams are online	
    function onlinecheck($online, $viewers, $topic)
    {  
//If the variable online is not equal to null, there is a good change this person is currently streaming	
		if ($online != null)
            {
		            echo '<a href="http://www.twitch.tv/'.$online.'"> <strong>'.$online.'</strong></a>'; 
                       	echo '&nbsp; </br>';
                   		//echo '<strong>'.$topic.'</strong> </br>';
        	}
	}
	
//This funcion add's online channel names to the checked online array	
    function signin($person){
	if($person != null){
		return $person;
	}
	else{
		return null;
	}
}
?>
La variable $userList lo recoje en otro codigo y la pasa por aki, y es el nombre del jugador

Pd: mi web es: http://starbound-esp.com/
__________________
Tu Hosting [URL="http://starbound-esp.com[/URL]

Etiquetas: form, modulo, php, stream, url
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:13.