All pastes #1520208 Raw Edit

xspf.php for player

public php v1 · immutable
#1520208 ·published 2009-08-06 07:31 UTC
rendered paste body
<?phpheader ("content-type: text/xml");// Image-Root Directory..$g_szImagesDir = 'content';// Global Variables used by 'BuildFileList' function...$g_szFileList = array();$g_iFileCount = 0;// Build File List of Imagesfunction BuildFileList( $szDir ){   global $g_iDepth, $g_szFileList, $g_iFileCount;   $oDirHandle = opendir( $szDir );   while( false !== ($szFile = readdir( $oDirHandle )) )   {       if( $szFile == '.' || $szFile == '..' ) continue;       $szCurrPath = $szDir.'/'.$szFile;       if( is_dir( $szCurrPath ) )       {           BuildFileList( $szCurrPath );       }else       {           if( (false !== strpos($szFile, '.flv')) || (false !== strpos($szFile, '.mp4')) || (false !== strpos($szFile, '.mp3')) )           {               $g_szFileList[$g_iFileCount++] = str_replace( './', '', $szCurrPath );           }       }   }   closedir( $oDirHandle );   return;}// Start the search for Images!BuildFileList( './' . $g_szImagesDir );?><playlist version="1" xmlns="http://xspf.org/ns/0/">	<title>Streaming video playlist</title>	<tracklist><?php       for( $i = 0; $i < $g_iFileCount; $i++ )       {	   $aux = str_replace( 'content/', '', $g_szFileList[$i] );	   if( false !== strpos($aux, '.flv')){		$type = 'VP6 Flash Video';		$title = str_replace( '.flv', '', $aux );	   }elseif( false !== strpos($aux, '.mp3')){		$type = 'MPEG-1 Layer 3 Audio';		$title = str_replace( '.mp3', '', $aux );	   }else{		$type = 'MP4 Video Container (likely H.264-based)';		$title = str_replace( '.mp4', '', $aux );	   }           if( $i == ($g_iFileCount - 1) )               echo "		<track>\n			<title>" . $title . "</title>\n			<creator>Remote Video Player Instance</creator>\n			<info>http://www.shawnhendershot.com/</info>\n			<annotation>" . $type . "</annotation>\n			<location>" . $g_szFileList[$i] . "</location>\n		</track>\n";           else               echo "		<track>\n			<title>" . $title . "</title>\n			<creator>Remote Video Player Instance</creator>\n			<info>http://www.shawnhendershot.com/</info>\n			<annotation>" . $type . "</annotation>\n			<location>" . $g_szFileList[$i] . "</location>\n		</track>\n\n";       } ?>	</tracklist></playlist>