3 include_once( "functions.php" );
5 function pretty_date( $date )
10 (int)( substr( $date, 11, 2 ) ),
11 (int)( substr( $date, 14, 2 ) ),
13 (int)( substr( $date, 5, 2 ) ),
14 (int)( substr( $date, 8, 2 ) ),
15 (int)( substr( $date, 0, 4 ) ) );
17 return date( "D d M, H:i", $tm );
20 function get_info_from_file( $fn )
28 $handle = fopen( $fn, "r" );
32 while ( !feof( $handle ) )
34 $line = fgets( $handle );
35 $line = substr( $line, 0, -1 );
37 list( $k, $v ) = split( "=", $line, 2 );
61 case "channel_pretty":
72 return array( $title, $date, $channel, $sub_title, $description );
75 function get_info_from_filename( $fn )
77 if( preg_match( '/^(.*?)-(.*)\\..*$/', $fn, $matches ) )
84 $title = substr( $fn, 0, strlen( $fn ) - 4 );
88 return array( $title, $date );
91 function get_info( $filename, $filenames )
97 if( preg_match( '/^(.*)\\.flv$/', $filename, $matches ) )
100 $infofn = $matches[1] . ".rtvinfo";
102 if( array_key_exists( $infofn, $filenames ) )
104 list( $title, $date, $channel, $sub_title, $description ) =
105 get_info_from_file( $videos_dir . "/" . $infofn );
109 list( $title, $date ) = get_info_from_filename( $filename );
114 $titles[$title][] = array( $num, $date, $channel, $sub_title,
119 return array( $title, $date, $channel, $sub_title, $description );
122 // This is a hash filename -> nothing of all files in the directory
123 $filenames = array();
124 $handle = opendir( $videos_dir );
127 while( ( $filename = readdir( $handle ) ) )
129 $filenames[$filename] = '';
135 // This is a hash title->array( array( filenumber, date, filename, channel ) )
139 $sorted_fns = array_keys( $filenames );
140 rsort( $sorted_fns );
142 foreach( $sorted_fns as $filename )
144 list( $title, $date, $channel, $sub_title, $description ) = get_info(
145 $filename, $filenames );
149 $titles[$title][] = array( $num, $date, $channel, $sub_title,
150 $description, $filename );
160 <title
>Recorded programmes
</title
>
161 <style type
="text/css">
163 font
-family
: verdana
, sans
-serif
;
167 text
-decoration
: none
;
177 span
.smalltime
:hover
{
192 <h1
>Recorded programmes
</h1
>
196 print "<table cellpadding='2'>\n";
198 foreach( $titles as $title => $arr )
200 list( $num, $date, $channel, $sub_title ) = $arr[0];
201 print "<tr><th style='border-style: solid none none none; border-width: 1px; border-color: black;' width='50%' align='right' valign='top'>$title</th><td width='50%' class='dates'>";
203 foreach( $arr as $lst )
205 list( $num, $date, $channel, $sub_title, $description,
207 print "<a href='play.php?filename=$filename'";
209 print " title='$description'";
215 print $sub_title . " <span class='smalltime'>(";
218 print pretty_date( $date );
222 print " on $channel";
232 print "</td></tr>\n";
233 print "<tr><th></th><td><br /></td></tr>";