';
$sql = "SELECT id, name, description FROM channels ORDER BY id ASC";
$q = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($q)){
$nocurrent = 0; // Flag initialisieren
$content .= ' ';
$content .= '' . $row['name'] . " - " . $row['description']." ";
$content .= " Now playing: \n";
// Find out which video is streaming right now
$sqlx = "SELECT V.id, V.title, V.subtitle, V.duration, S.position
FROM videos AS V JOIN schedule AS S
ON V.id = S.video_id
WHERE S.channel_id = ".$row['id']."
AND S.position <= ".$now
." ORDER BY S.position DESC LIMIT 1";
/*
With use of S.day_id (for future versions):
$sqlx = "SELECT V.title, V.subtitle, V.duration, S.position
FROM videos AS V JOIN schedule AS S
ON V.id = S.video_id
WHERE S.day_id = ".$day." AND S.channel_id = ".$row['id']."
AND S.position <= ".$now.' ORDER BY S.position DESC LIMIT 1';
*/
$qq = mysql_query($sqlx) or die(mysql_error());
$rrow = mysql_fetch_array($qq);
if (($rrow['position'] + $rrow['duration']) < $now ) {
$content .= "No Programme at the moment";
$nocurrent = 1; // Flag setzen
}
else {
$content .= '' . $rrow['title']. " " .
' (since ' . hrtime($rrow['position']).' h) ';
/* Show preview pics,
* if they are created during upload and saved somewhere (in future versions)
for ($i=1; $i <= 3; $i++) { // 3 preview pics for each video
*
* 1. If nessecary, first copy the preview-pics from a remote server to the
* local file system. Filename is pic_.jpg
*
$previewlocation = 'http://foo.bar/previewpics/pic'
. $i. '_' . $rrow['id'] .'.jpg';
if (!copy($previewlocation, $previewpath."pic".$i.'_'.$rrow['id'].".jpg"))
{
print ("failed to copy $previewlocation ... \n");
}
if (file_exists($previewpath."pic".$i."_".$rrow['id'].".jpg"))
{
$content .= ' ';
}
*
* 2. Just link to the preview picture on the remote server
*
$previewlocation = 'http://foo.bar/previewpics/pic'
. $i. '_' . $rrow['id'] .'.jpg';
$previewpic = fopen ($previewlocation, "r");
if (!$previewpic) {
$content .= "No image";
}
else {
$content .= ' ';
}
}
*/
$content .= "
Programme Guide ";
$content .= " |
URL ";
$content .= " ";
}
} // End while channels
$content .= '
';
// Select the player
$content .= '