[xiph-commits] r18480 - in branches/dir.xiph.org: . cgi-bin cronjobs css inc templates

balbinus at svn.xiph.org balbinus at svn.xiph.org
Sun Jul 29 11:27:54 PDT 2012


Author: balbinus
Date: 2012-07-29 11:27:53 -0700 (Sun, 29 Jul 2012)
New Revision: 18480

Added:
   branches/dir.xiph.org/documentation.txt
   branches/dir.xiph.org/templates/search_results.xspf.tpl
Modified:
   branches/dir.xiph.org/by_genre.php
   branches/dir.xiph.org/cgi-bin/yp.php
   branches/dir.xiph.org/cronjobs/check_servers.php
   branches/dir.xiph.org/cronjobs/check_servers.sh
   branches/dir.xiph.org/cronjobs/generate_top.php
   branches/dir.xiph.org/cronjobs/generate_xml.php
   branches/dir.xiph.org/css/style.css
   branches/dir.xiph.org/inc/class.db.php
   branches/dir.xiph.org/inc/class.mountpoint.php
   branches/dir.xiph.org/inc/class.server.php
   branches/dir.xiph.org/inc/lib.apilog.php
   branches/dir.xiph.org/inc/lib.errors.php
   branches/dir.xiph.org/inc/lib.statslog.php
   branches/dir.xiph.org/listen.php
   branches/dir.xiph.org/search.php
   branches/dir.xiph.org/templates/foot.tpl
   branches/dir.xiph.org/templates/head.tpl
   branches/dir.xiph.org/templates/streams_list.tpl
Log:
LOADS OF CHANGES. Some add XSPF playlists, other alleviate the load on the db... oh god I should have commited them earlier.


Modified: branches/dir.xiph.org/by_genre.php
===================================================================
--- branches/dir.xiph.org/by_genre.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/by_genre.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -13,6 +13,12 @@
 }
 if (array_key_exists('PATH_INFO', $_SERVER))
 {
+	if (substr($_SERVER['PATH_INFO'], -5) == '.xspf')
+	{
+	    $output_format = 'xspf';
+	    $_SERVER['PATH_INFO'] = substr($_SERVER['PATH_INFO'], 0, -5);
+	}
+	
 	$search_string = preg_replace('|^/([^\s/]+).*$|', '$1', $_SERVER['PATH_INFO']);
 	$search_string = substr($search_string, 0, 15);
 	$tpl->assign('search_keyword', $search_string);
@@ -101,6 +107,8 @@
 	$tpl->assign('display_tag_cloud', true);
 }
 
+if (empty($output_format) || $output_format != 'xspf')
+{
 // Header
 $tpl->display("head.tpl");
 
@@ -129,5 +137,12 @@
 }
 $tpl->assign("/search/by_genre");
 $tpl->display('foot.tpl');
+}
+elseif ($output_format == 'xspf')
+{
+  header('Content-Type: application/xspf+xml');
+  $tpl->assign('xspf_title', 'Search results for '.$search_string);
+  $tpl->display('search_results.xspf.tpl');
+}
 
 ?>

Modified: branches/dir.xiph.org/cgi-bin/yp.php
===================================================================
--- branches/dir.xiph.org/cgi-bin/yp.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/cgi-bin/yp.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -43,7 +43,7 @@
 		try
 		{
 		    // Check the args are here
-		    $mandatory_args = array('sn', 'type', 'genre', 'b', 'listenurl');
+		    $mandatory_args = array('sn', 'type', 'genre', 'listenurl');
 		    foreach ($mandatory_args as $a)
 		    {
 		        if (!array_key_exists($a, $_REQUEST) || empty($_REQUEST[$a]))
@@ -73,13 +73,27 @@
 		    }
 		    // Genre, space-normalized
 		    $genre = clean_string($_REQUEST['genre']);
-		    $genre = str_replace(array('+', '-', '*', '<', '>', '~', '"', '(', ')', '|', '!', '?', ',', ';', ':', '/'),
-							     array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
+		    $genre = str_replace(array('+', '-', '*', '<', '>', '~', '"', '(', ')', '|', '!', '?', ',', ';', ':', '/', '&'),
+							     array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
 							     $genre);
 		    $genre = preg_replace('/\s+/', ' ', $genre);
-		    $genre_list = array_slice(explode(' ', $genre), 0, 10);
+		    $genre_list = array_slice(explode(' ', trim($genre)), 0, 10);
 		    // Bitrate
-		    $bitrate = clean_string($_REQUEST['b']);
+		    if  (isset($_REQUEST['b']) && !empty($_REQUEST['b']))
+			    $bitrate = clean_string($_REQUEST['b']);
+		    else if  (isset($_REQUEST['bitrate']) && !empty($_REQUEST['bitrate']))
+			    $bitrate = clean_string($_REQUEST['bitrate']);
+		    else
+		    {
+			    $x = str_replace(";", "&", urldecode(substr(strrchr(file_get_contents('php://input'), "&"), 1)));
+			    parse_str ($x , $hack);
+			    if (isset($hack['quality']))
+				    $bitrate = "Quality " . clean_string($hack['quality']);
+			    else if (isset($hack['bitrate']))
+				    $bitrate = clean_string($hack['bitrate']);
+			    else
+				    throw new ServerRefusedAPIException('Not enough arguments.', SERVER_REFUSED_MISSING_ARG, 'b');
+		    }
 		    // Listen URL
 		    $listen_url = clean_string($_REQUEST['listenurl']);
             // Verify the URL
@@ -190,7 +204,7 @@
 			    header("YPResponse: 1");
 			    header("YPMessage: Successfully added.");
 			    header("SID: ".$sid);
-			    header("TouchFreq: 250");
+			    header("TouchFreq: 242");
                 
                 // Log stuff
                 APILog::request(REQUEST_ADD, true, $listen_url, $server_id,

Modified: branches/dir.xiph.org/cronjobs/check_servers.php
===================================================================
--- branches/dir.xiph.org/cronjobs/check_servers.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/cronjobs/check_servers.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -49,7 +49,7 @@
             {
                 $fp = @fsockopen($url['host'],
                                  array_key_exists('port', $url) ? $url['port'] : 80, // as per HTTP RFC
-                                 $errno, $errstr, 5);
+                                 $errno, $errstr, 3);
                 if (!$fp)
                 {
                     $count++;

Modified: branches/dir.xiph.org/cronjobs/check_servers.sh
===================================================================
--- branches/dir.xiph.org/cronjobs/check_servers.sh	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/cronjobs/check_servers.sh	2012-07-29 18:27:53 UTC (rev 18480)
@@ -17,7 +17,9 @@
 	echo "Creating lockfile..."
 	touch "$LOCKFILE"
 	echo "Running check_servers.php..."
-	/usr/bin/php5 `dirname $0`/check_servers.php > $LOGFILE 2>&1
+	/usr/bin/php5 `dirname $0`/check_servers1.php > $LOGFILE 2>&1
+date >> /tmp/${ENVIRONMENT}_list
+cat $LOGFILE >> /tmp/${ENVIRONMENT}_list
 	rm "$LOCKFILE"
 	echo "OK."
 fi

Modified: branches/dir.xiph.org/cronjobs/generate_top.php
===================================================================
--- branches/dir.xiph.org/cronjobs/generate_top.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/cronjobs/generate_top.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -18,8 +18,12 @@
 
 try
 {
-//    $query = 'SELECT * FROM `mountpoint` ORDER BY `listeners` DESC LIMIT %d;';
-    $query = 'SELECT `id` FROM `mountpoint` ORDER BY RAND() LIMIT %d;';
+//    $query = 'SELECT `id` FROM `mountpoint` ORDER BY `listeners` DESC LIMIT %d;';
+    $query = 'SELECT m.`id`, SUM(s.`checked`) / COUNT(*) AS `checked` '
+            .'FROM `mountpoint` AS m INNER JOIN `server` AS s ON m.`id` = s.`mountpoint_id` '
+            .'GROUP BY m.`id` '
+            .'HAVING `checked` = 1 ORDER BY m.`listeners` DESC LIMIT %d;';
+//    $query = 'SELECT `id` FROM `mountpoint` ORDER BY RAND() LIMIT %d;';
     $query = sprintf($query, MAX_STREAMS_ON_HOMEPAGE);
     $data = $db->selectQuery($query);
 	$res = array();

Modified: branches/dir.xiph.org/cronjobs/generate_xml.php
===================================================================
--- branches/dir.xiph.org/cronjobs/generate_xml.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/cronjobs/generate_xml.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -3,24 +3,29 @@
 // Inclusions
 include_once(dirname(__FILE__).'/../inc/prepend.php');
 
+ini_set('memory_limit', '32M');
+
 define('XML_OUTPUT', dirname(__FILE__).'/../yp.xml');
 
 // Database connection
 $db = DirXiphOrgDBC::getInstance();
 
 // Get data
-$query = "SELECT m.`stream_name`, s.`listen_url`, m.`media_type_id`, m.`bitrate`, m.`channels`, m.`samplerate`, GROUP_CONCAT(t.`tag_name` SEPARATOR ' ') AS `genre`, m.`current_song` FROM `mountpoint` AS m INNER JOIN `server` AS s ON m.`id` = s.`mountpoint_id` INNER JOIN `mountpoints_tags` AS mt ON mt.`mountpoint_id` = m.`id` INNER JOIN `tag` AS t ON mt.`tag_id` = t.`id` GROUP BY s.`id` ORDER BY NULL;";
+$query = "SELECT m.`stream_name`, s.`listen_url`, m.`media_type_id`, m.`bitrate`, m.`channels`, m.`samplerate`, GROUP_CONCAT(t.`tag_name` SEPARATOR ' ') AS `genre`, m.`current_song` FROM `mountpoint` AS m INNER JOIN `server` AS s ON m.`id` = s.`mountpoint_id` INNER JOIN `mountpoints_tags` AS mt ON mt.`mountpoint_id` = m.`id` INNER JOIN `tag` AS t ON mt.`tag_id` = t.`id` GROUP BY s.`id` ORDER BY m.`listeners` DESC LIMIT 1000;";
 $res = $db->selectQuery($query)->array_data;
+shuffle($res);
 $tpl->assign_by_ref('streams', $res);
 $xml = $tpl->fetch('yp.xml.tpl');
 
 // Write data
-$fp = fopen(XML_OUTPUT.'.tmp', 'w');
+$temp_filename = XML_OUTPUT.'.tmp.'. sha1(uniqid(rand(), true));
+echo $temp_filename."\n";
+$fp = fopen($temp_filename, 'w');
 $l = fwrite($fp, $xml);
 fclose($fp);
 if ($l == strlen($xml))
 {
-    if (rename(XML_OUTPUT.'.tmp', XML_OUTPUT))
+    if (rename($temp_filename, XML_OUTPUT))
     {
         echo "OK.\n";
         exit();

Modified: branches/dir.xiph.org/css/style.css
===================================================================
--- branches/dir.xiph.org/css/style.css	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/css/style.css	2012-07-29 18:27:53 UTC (rev 18480)
@@ -170,6 +170,11 @@
         width: 990px;
 }
 
+.no-link {
+	color: #333;
+	text-decoration: none;
+}
+
 /* Tag list */
 .inline-tags {
     list-style-type: none;

Added: branches/dir.xiph.org/documentation.txt
===================================================================
--- branches/dir.xiph.org/documentation.txt	                        (rev 0)
+++ branches/dir.xiph.org/documentation.txt	2012-07-29 18:27:53 UTC (rev 18480)
@@ -0,0 +1,20 @@
+inc:
+ * class.db.php: MySQL connection + querying
+ * class.izterator*.php: resultset iterator + factory (=> migrate to SPL?)
+ * class.mc.php: Memcache connection + querying (probably useless)
+ * class.mountpoint.php: a mountpoint (== stream), linking to 1+ server
+ * class.server.php: an instance of a mountpoint on a particular Icecast server
+ * class.sphinxApi.php: Sphinx connection + querying
+ * class.tag.php: a genre tag
+ * class.ypclient.php: test client class + load test code
+ * inc.db.php: initializes the database connection
+ * inc.mc.php: initializes the memcache connection
+ * inc.templating.php: initializes the templating system (Smarty)
+ * lib.apilog.php: API logging (not in use currently)
+ * lib.dir.php: helper functions (directory-specific, fixme: not in a class)
+ * lib.errors.php: error handling (mail)
+ * lib.genfile.php: generated files (file cache of heavy queries)
+ * lib.statslog.php: Stats logging (not in use currently)
+ * lib.utils.php: helper functions (generic)
+ * lib.uuidgend.php: generation of UUIDs (for SIDs)
+ * prepend.php: loads all the other files (even if they're not really needed :/)

Modified: branches/dir.xiph.org/inc/class.db.php
===================================================================
--- branches/dir.xiph.org/inc/class.db.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/class.db.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -3,8 +3,6 @@
 /**
  * Database interfaces.
  *
- * @version $Id$
- * @copyright 2005-2007
  * @author Vincent Tabard
  */
 

Modified: branches/dir.xiph.org/inc/class.mountpoint.php
===================================================================
--- branches/dir.xiph.org/inc/class.mountpoint.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/class.mountpoint.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -4,7 +4,7 @@
 {
     protected $mountpoint_id = 0;
     protected static $table_name = 'mountpoint';
-    protected $cache_expiration = 60;
+    protected $cache_expiration = 120;
     public $loaded = false;
     
     protected $stream_name;

Modified: branches/dir.xiph.org/inc/class.server.php
===================================================================
--- branches/dir.xiph.org/inc/class.server.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/class.server.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -4,7 +4,7 @@
 {
     protected $server_id = 0;
     protected static $table_name = 'server';
-    protected static $cache_expiration = 60;
+    protected static $cache_expiration = 120;
     public $loaded = false;
     
     protected $mountpoint_id;

Modified: branches/dir.xiph.org/inc/lib.apilog.php
===================================================================
--- branches/dir.xiph.org/inc/lib.apilog.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/lib.apilog.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -5,7 +5,7 @@
     public static function log($result, $listen_url = null,
                                $server_id = null, $mountpoint_id = null)
     {
-        $db = DirXiphOrgLogDBC::getInstance();
+/*        $db = DirXiphOrgLogDBC::getInstance();
         
         $ip = utils::getRealIp();
         $ip = $ip !== false ? $ip : '127.0.0.1';
@@ -17,7 +17,8 @@
                              $ip,
                              $listen_url !== null ? hash('md5', $listen_url) : 0,
                              $server_id, $mountpoint_id);
-        $db->noReturnQuery($sql);
+        $db->noReturnQuery($sql);*/
+        return true;
     }
     
     public static function serverAdded($ok, $server_id, $mountpoint_id,
@@ -69,7 +70,7 @@
     
     public static function serverRefused($reason, $listen_url = false)
     {
-        $db = DirXiphOrgLogDBC::getInstance();
+/*        $db = DirXiphOrgLogDBC::getInstance();
         
         $ip = utils::getRealIp();
         $ip = $ip !== false ? $ip : '127.0.0.1';
@@ -81,12 +82,13 @@
                              $ip,
                              $listen_url != false ? $db->escape($listen_url) : '',
                              $listen_url != false ? sprintf('%u', crc32($listen_url)) : 0);
-        $db->noReturnQuery($sql);
+        $db->noReturnQuery($sql);*/
+        return true;
     }
     
     public static function sidIssued($sid, $server_id, $mountpoint_id, $listen_url)
     {
-        $db = DirXiphOrgLogDBC::getInstance();
+/*        $db = DirXiphOrgLogDBC::getInstance();
         
         $ip = utils::getRealIp();
         $ip = $ip !== false ? $ip : '127.0.0.1';
@@ -100,7 +102,9 @@
                              $listen_url != false ? $db->escape($listen_url) : '',
                              $listen_url != false ? hash('md5', $listen_url) : '',
                              $db->escape($ip));
-        $db->noReturnQuery($sql);
+        $db->noReturnQuery($sql);*/
+        
+        return true;
     }
 }
 

Modified: branches/dir.xiph.org/inc/lib.errors.php
===================================================================
--- branches/dir.xiph.org/inc/lib.errors.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/lib.errors.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -6,6 +6,8 @@
 function mail_error($mail_to, $mail_from,
                     $errstr, $errfile, $errline, $trace='')
 {
+    return true;
+
     $data = <<<EOF
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Modified: branches/dir.xiph.org/inc/lib.statslog.php
===================================================================
--- branches/dir.xiph.org/inc/lib.statslog.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/inc/lib.statslog.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -8,7 +8,7 @@
     
     public static function playlistAccessed($mountpoint_id, $stream_name)
     {
-        $db = DirXiphOrgLogDBC::getInstance();
+/*        $db = DirXiphOrgLogDBC::getInstance();
 
         $ip = utils::getRealIp();
         $ip = $ip !== false ? $ip : '127.0.0.1';
@@ -19,12 +19,13 @@
         $sql = sprintf($sql, date('Ymd'), $mountpoint_id,
                         $db->escape(hash('md5', $stream_name)),
                         $db->escape($ip));
-        $db->query($sql);
+        $db->query($sql);*/
+        return true;
     }
     
     public static function keywordsSearched($search_type, $search_keywords)
     {
-        $db = DirXiphOrgLogDBC::getInstance();
+/*        $db = DirXiphOrgLogDBC::getInstance();
         
         $ip = utils::getRealIp();
         $ip = $ip !== false ? $ip : '127.0.0.1';
@@ -34,7 +35,8 @@
               ."VALUES ('%s', %d, INET_ATON('%s'));";
         $sql = sprintf($sql, date('Ymd'), $db->escape($search_keywords),
                         intval($search_type), $db->escape($ip));
-        $db->query($sql);
+        $db->query($sql);*/
+        return true;
     }
 }
 

Modified: branches/dir.xiph.org/listen.php
===================================================================
--- branches/dir.xiph.org/listen.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/listen.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -118,7 +118,7 @@
         }
 
         // Data
-        echo implode("\r\n", $playlist);
+        echo implode("\r\n", $playlist)."\r\n";
         break;
     case FILE_TYPE_XSPF:
         // Header

Modified: branches/dir.xiph.org/search.php
===================================================================
--- branches/dir.xiph.org/search.php	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/search.php	2012-07-29 18:27:53 UTC (rev 18480)
@@ -64,7 +64,17 @@
 			// Cache miss. Now query the database.
 			try
 			{
-                $query = 'SELECT * FROM `mountpoint` WHERE `stream_name` LIKE "%1$s" OR `description` LIKE "%1$s" OR `id` IN (SELECT `mountpoint_id` FROM `mountpoints_tags` AS mt INNER JOIN `tag` AS t ON mt.`tag_id` = t.`id` WHERE `tag_name` IN (%2$s)) ORDER BY `listeners` DESC LIMIT %3$d;';
+//                $query = 'SELECT * FROM `mountpoint` WHERE `stream_name` LIKE "%1$s" OR `description` LIKE "%1$s" OR `id` IN (SELECT `mountpoint_id` FROM `mountpoints_tags` AS mt INNER JOIN `tag` AS t ON mt.`tag_id` = t.`id` WHERE `tag_name` IN (%2$s)) ORDER BY `listeners` DESC LIMIT %3$d;';
+                 $query = 'SELECT m.* FROM '
+                                .'(SELECT * FROM `mountpoint` '
+                                .'WHERE `stream_name` LIKE "%1$s" OR `description` LIKE "%1$s" '
+                                .'OR `id` IN '
+                                        .'(SELECT `mountpoint_id` FROM `mountpoints_tags` AS mt '
+                                        .'INNER JOIN `tag` AS t ON mt.`tag_id` = t.`id` '
+                                        .'WHERE `tag_name` IN (%2$s)) '
+                                .'ORDER BY `listeners` DESC) AS m '
+                         .'INNER JOIN `server` AS s ON m.`id` = s.`mountpoint_id` ' 
+                         .'GROUP BY m.`id` ORDER BY NULL';
                 $query = sprintf($query,
                                  mysql_real_escape_string($search_string),
                                  $search_in,

Modified: branches/dir.xiph.org/templates/foot.tpl
===================================================================
--- branches/dir.xiph.org/templates/foot.tpl	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/templates/foot.tpl	2012-07-29 18:27:53 UTC (rev 18480)
@@ -6,7 +6,7 @@
 				<h4>Queries:</h4>
 				<ul>
 {foreach item=query from=$sql_debug}
-					<li>[{$query.time} ms] {$query.query|truncate}</li>
+					<li>[{$query.time} ms] {$query.query}</li>
 {/foreach}
 				</ul>
 {/if}

Modified: branches/dir.xiph.org/templates/head.tpl
===================================================================
--- branches/dir.xiph.org/templates/head.tpl	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/templates/head.tpl	2012-07-29 18:27:53 UTC (rev 18480)
@@ -3,12 +3,12 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<meta name="description" value="MP3 streams, webradios, Ogg Vorbis streams... If you want to listen to music, free music, this stream directory is the right place for you. Icecast YP is just like Shoutcast.com, featuring radio listings." />
+		<meta name="description" content="MP3 streams, webradios, Ogg Vorbis streams... If you want to listen to music, free music, this stream directory is the right place for you. Icecast YP is just like Shoutcast.com, featuring radio listings." />
 		<title>Streaming directory -- streams &amp; radios</title>
 		<link rel="icon" href="http://www.icecast.org/favicon.ico" type="image/x-icon"/>
 		<link rel="shortcut icon" href="http://www.icecast.org/favicon.ico" type="image/x-icon"/>
 		<link rel="stylesheet" href="http://www.xiph.org/css/screen.css" type="text/css"/>
-		<link rel="stylesheet" href="/css/style.css?20080525" type="text/css" />
+		<link rel="stylesheet" href="/css/style.css?20080530" type="text/css" />
 	</head>
 	<body>
 		<div id="xiphbar_outer" style="@import url(/common/xiphbar.css);">

Added: branches/dir.xiph.org/templates/search_results.xspf.tpl
===================================================================
--- branches/dir.xiph.org/templates/search_results.xspf.tpl	                        (rev 0)
+++ branches/dir.xiph.org/templates/search_results.xspf.tpl	2012-07-29 18:27:53 UTC (rev 18480)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<playlist version="1" xmlns="http://xspf.org/ns/0/">
+{if !empty($xspf_title)}
+  <title>{$xspf_title|escape}</title>
+{/if}
+  <creator>dir.xiph.org</creator>
+  <info>http://dir.xiph.org/</info>
+{if $results !== false}
+  <trackList>
+{foreach from=$results item=stream}
+    <track>
+      <title>{$stream->getStreamName()|escape}</title>
+{if $stream->getUrl() != ''}
+      <info>{if substr($stream->getUrl(), 0, 4) == 'http'}{$stream->getUrl()|escape}{else}http://{$stream->getUrl()|escape}{/if}</info>
+{/if}
+      <meta rel="http://dir.xiph.org/xpsf/listeners">{$stream->getListeners()|intval}</meta>
+{if $stream->getDescription() != ''}
+      <annotation>{$stream->getDescription()|escape}</annotation>
+{/if}
+{if $stream->getCurrentSong() != ''}
+      <meta rel="http://dir.xiph.org/xspf/currentSong">{$stream->getCurrentSong()|escape}</meta>
+{/if}
+{assign var=tags value=$stream->getTags()}
+{if $tags != false}
+{foreach item=tag_name key=tag_id from=$tags}
+      <meta rel="http://dir.xiph.org/xspf/tag">{$tag_name|capitalize:true|escape}</meta>
+{/foreach}
+{/if}
+      <location>http://dir.xiph.org/listen/{$stream->getId()|intval}/listen.xspf</location>
+    </track>
+{/foreach}
+  </trackList>
+{/if}
+</playlist>

Modified: branches/dir.xiph.org/templates/streams_list.tpl
===================================================================
--- branches/dir.xiph.org/templates/streams_list.tpl	2012-07-29 14:12:34 UTC (rev 18479)
+++ branches/dir.xiph.org/templates/streams_list.tpl	2012-07-29 18:27:53 UTC (rev 18480)
@@ -32,10 +32,10 @@
 							</td>
 							<td class="tune-in">
 							    <p class="format">Tune in:</p>
-								<p>[ <a href="{$root_url}/listen/{$stream->getId()}/listen.m3u" title="Listen to '{$stream->getStreamName()|truncate:20:"...":true|escape}'"{* class="tune-in-button"*} onclick="javascript:pageTracker._trackPageview('/stream/listen/m3u');">M3U</a> | <a href="{$root_url}/listen/{$stream->getId()}/listen.xspf" title="Listen to '{$stream->getStreamName()|truncate:20:"...":true|escape}'"{* class="tune-in-button"*} onClick="javascript:pageTracker._trackPageview('/stream/listen/xspf');">XSPF</a> ]</p>
+								<p>[ <a href="{$root_url}/listen/{$stream->getId()}/listen.m3u" title="Listen to '{$stream->getStreamName()|truncate:20:"...":true|escape}'"{* class="tune-in-button"*} onclick="javascript:pageTracker._trackPageview('/stream/listen/m3u');">M3U</a> | <a href="{$root_url}/listen/{$stream->getId()}/listen.xspf" title="Listen to '{$stream->getStreamName()|truncate:20:"...":true|escape}'"{* class="tune-in-button"*} onclick="javascript:pageTracker._trackPageview('/stream/listen/xspf');">XSPF</a> ]</p>
 {if $stream->getMediaTypeId() != ''}
 								<p class="format"{if $stream->getBitrate() != ''} title="{if is_numeric($stream->getBitrate())}{$stream->getBitrate()|intval} kbps{else}{$stream->getBitrate()}{/if}"{/if}>
-									<a href="{$root_url}/by_format/{$stream->getMediaTypeId()|get_media_type_url}" title="More {$stream->getMediaTypeId()|get_media_type} streams">{$stream->getMediaTypeId()|get_media_type}<span class="stream"> stream</span></a>
+									<a href="{$root_url}/by_format/{$stream->getMediaTypeId()|get_media_type_url}" class="no-link" title="More {$stream->getMediaTypeId()|get_media_type} streams">{$stream->getMediaTypeId()|get_media_type}<span class="stream"> stream</span></a>
 									{*if (!empty($stream.channels) && is_numeric($stream.channels))}{if ($stream.channels == 1)}mono{elseif $stream.channels == 2}stereo{else}{$stream.channels} ch{/if}{/if*}
 								</p>
 {/if}
@@ -46,13 +46,13 @@
 {if !empty($results_pages)}
                                         <ul class="pager">
 {if $results_page_no != 1}
-						<li><a href="?page={$results_page_no-2}">«</a></li>
+						<li><a href="?{if !empty($search_keyword)}search={$search_keyword}&amp;{/if}page={$results_page_no-2}">«</a></li>
 {/if}
 {foreach item=page from=$results_pages}
-                                                <li><a{if $page == $results_page_no} class="active"{/if} href="?page={$page-1}">{$page}</a></li>
+                                                <li><a{if $page == $results_page_no} class="active"{/if} href="?{if !empty($search_keyword)}search={$search_keyword}&amp;{/if}page={$page-1}">{$page}</a></li>
 {/foreach}
 {if $results_page_no != $results_pages_total}
-                                                <li><a href="?page={$results_page_no}">»</a></li>
+                                                <li><a href="?{if !empty($search_keyword)}search={$search_keyword}&amp;{/if}page={$results_page_no}">»</a></li>
 {/if}
 
                                         </ul>



More information about the commits mailing list