--- /dev/null
+#!/usr/bin/perl -w
+
+$template_file = "/home/ivan/radio/template.html";
+
+use CGI;
+use HTML::Table;
+use Text::Template;
+
+%type2color = (
+ 'upcoming' => '999966',
+ 'live' => 'ffffcc',
+ 'rebroadcast' => 'ffcc99',
+);
+
+%shows = (
+ 'high_jinx' => {
+ 'name' => 'High Jinx',
+ 'day' => 'sunday',
+ 'start' => '19',
+ 'len' => '3',
+ 'type' => 'upcoming',
+ 'startdate' => 'May 6th',
+ },
+ 'high_jinx_rebroadcast' => {
+ 'name' => 'High Jinx',
+ 'day' => 'monday',
+ 'start' => '13',
+ 'len' => '3',
+ 'type' => 'upcoming',
+ 'startdate' => 'May 7th',
+ },
+ 'dub_monday' => {
+ 'name' => 'Dub Monday',
+ 'day' => 'monday',
+ 'start' => '19.5',
+ 'len' => '2',
+ 'url' => 'http://www.voyager.org/sets',
+ 'type' => 'live',
+ },
+ 'dub_monday_rebroadcast' => {
+ 'name' => 'Dub Monday',
+ 'day' => 'tuesday',
+ 'start' => '13',
+ 'len' => '2',
+ 'url' => 'http://www.voyager.org/sets',
+ 'type' => 'rebroadcast',
+ },
+ 'organized_chaos' => {
+ #'name' => 'Organized<BR>Chaos',
+ 'name' => 'Organized Chaos',
+ 'day' => 'wednesday',
+ 'start' => '20',
+ 'len' => '3',
+ 'url' => 'http://www.angelfire.com/rant/burf/oc.html',
+ 'type' => 'live',
+ },
+ 'organized_chaos_rebroadcast' => {
+ #'name' => 'Organized<BR>Chaos',
+ 'name' => 'Organized Chaos',
+ 'day' => 'thursday',
+ 'start' => '13',
+ 'len' => '3',
+ 'url' => 'http://www.angelfire.com/rant/burf/oc.html',
+ 'type' => 'rebroadcast',
+ },
+ 'echo_communication_system' => {
+ #'name' => 'Echo<BR>Communication<BR>System',
+ #'name' => 'Echo Communication System',
+ 'name' => 'Echo Communication System',
+ 'day' => 'thursday',
+ 'start' => '19',
+ 'len' => '3',
+ 'url' => 'http://www.theoverworld.com/echo/',
+ 'type' => 'live',
+ },
+ 'echo_communication_system__rebroadcast' => {
+ #'name' => 'Echo<BR>Communication<BR>System',
+ #'name' => 'Echo Communication System',
+ 'name' => 'Echo Communication System',
+ 'day' => 'friday',
+ 'start' => '13',
+ 'len' => '3',
+ 'url' => 'http://www.theoverworld.com/echo/',
+ 'type' => 'rebroadcast',
+ },
+);
+
+@times = qw( midnight 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am 11am noon 1pm
+ 2pm 3pm 4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm );
+$increment = 0.5;
+$showstart = 12;
+
+$cgi = new CGI;
+if ( $cgi->param('showstart') =~ /^(\d+)$/ ) {
+ die unless $1 < 24;
+ $showstart = $1;
+}
+
+@showtimes = @times[$showstart..23];
+
+$template = new Text::Template ( TYPE => 'FILE', SOURCE => $template_file )
+ or die "Can't create template for $template_file: $Text::Template::ERROR";
+
+my $text = $template->fill_in()
+ or die "Can't fill in template for $template_file: $Text::Template::ERROR";
+
+print $cgi->header, $text;
+
+# subroutines for the template
+
+sub table {
+
+ my $rows = 1 + scalar(@showtimes)*(1/$increment);
+ #$rows += 10;
+ my $table = new HTML::Table($rows+20,8+2);
+# $table->setBorder(0);
+ $table->setCellSpacing('0');
+ $table->setCellPadding('1');
+
+ my $daycol=2;
+ foreach my $day ( map "${_}day", qw( Sun Mon Tues Wednes Thurs Fri Satur ) ) {
+ $table->setCell(1, $daycol, "<B>${day}</B>" );
+ $table->setCellAlign(1, $daycol, 'CENTER');
+
+ my @dayshows =
+ sort { $shows{$a}{'start'} <=> $shows{$b}{'start'} }
+ grep { lc($shows{$_}{day}) eq lc($day) } keys %shows;
+ my $pshowrow = 2;
+ foreach my $show ( @dayshows ) {
+
+ my $text = "<B>$shows{$show}{name}</B>";
+ $text = qq(<A HREF="$shows{$show}{url}">$text</A>)
+ if exists $shows{$show}{url};
+ if ( $shows{$show}{type} eq 'upcoming' ) {
+ $text .= qq(<BR><FONT SIZE="-1">starts $shows{$show}{startdate}</FONT>);
+ #$text .= '<BR><FONT SIZE="-1">starts May Xth</FONT>';
+ }
+ if ( $shows{$show}{type} eq 'live' ) {
+ $text .= "<BR><B>LIVE</B> ";
+ }
+ if ( $shows{$show}{type} eq 'rebroadcast' ) {
+ #$text .= "<BR><B>rebroadcast</B> ";
+ $text .= qq(<BR><FONT SIZE="-1">rebroadcast</FONT> );
+ }
+ if ( $shows{$show}{type} =~ /^(live|rebroadcast)$/ ) {
+ my $start = $shows{$show}{start};
+ my $stext = $times[ $start ];
+ $stext =~ s/([0-9])([ap]m)/$1:30$2/ if $start != int($start);
+ my $end = $shows{$show}{start} + $shows{$show}{len};
+ my $etext = $times[$end];
+ $etext =~ s/([0-9])([ap]m)/$1:30$2/ if $end != int($end);
+ #$text .= "<B>$stext-$etext</B>";
+ $text .= qq(<FONT SIZE="-1">$stext-$etext</FONT>);
+ }
+
+ my $showrow = 2 + (1/$increment) * ( $shows{$show}{start} - $showstart);
+
+ if ( $pshowrow < $showrow ) {
+ #$table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>'. "($showrow/$pshowrow) ".($showrow-$pshowrow));
+ $table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>');
+ $table->setCellAlign($pshowrow, $daycol, 'CENTER');
+ $table->setCellRowSpan( $pshowrow, $daycol, $showrow-$pshowrow );
+ #$table->setCellRowSpan( $pshowrow, $daycol, 1 );
+ $table->setCellBGColor( $pshowrow, $daycol, '89201b' );
+ }
+ $table->setCell($showrow, $daycol, $text );
+ $table->setCellAlign($showrow, $daycol, 'CENTER');
+ $table->setCellBGColor($showrow, $daycol,
+ $type2color{$shows{$show}{type}});
+ my $span = $shows{$show}{len} * (1/$increment);
+ $table->setCellRowSpan($showrow, $daycol, $span );
+
+ $pshowrow=$showrow+$span;
+ }
+
+ if ( $pshowrow < $rows+1 ) {
+ #$table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>'. "($rows+1/$pshowrow) ".($rows+1-$pshowrow));
+ $table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>');
+ $table->setCellAlign($pshowrow, $daycol, 'CENTER');
+ $table->setCellRowSpan( $pshowrow, $daycol, $rows+1-$pshowrow );
+ #$table->setCellRowSpan( $pshowrow, $daycol, 2 );
+ $table->setCellBGColor( $pshowrow, $daycol, '89201b' );
+ }
+
+ $daycol++;
+ }
+
+ my $timerow = 2;
+ foreach my $time ( @showtimes ) {
+ my $text = $time;
+ $text = qq(<FONT SIZE="-1">$text</FONT>) if length($text) > 4;
+ $table->setCell( $timerow, 1, "<B>$text</B>" );
+ $table->setCellAlign( $timerow, 1, 'CENTER' );
+ $table->setCellRowSpan( $timerow, 1, 1/$increment );
+ #$table->setCell( $timerow+1, 1, "<B>$text:30</B>" );
+# $table->setCell( $timerow+1, 1, " " );
+# $table->setCellAlign( $timerow+1, 1, 'CENTER' );
+ $timerow += 1/$increment;
+ }
+
+ local $^W=0;
+ my $html = $table->getTable;
+ $html =~ s/<! spanned cell\)>//g;
+ return $html;
+}
+
+
--- /dev/null
+<HTML>
+<HEAD>
+<TITLE>haze.st radio</TITLE>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+</HEAD>
+<body bgcolor="#336699" link="#660000" alink="#990000" vlink="#660000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td height="22" colspan="5" bgcolor="89201B"> </td>
+ </tr>
+ <tr align="center" valign="top">
+ <td colspan="5" bgcolor="#336699">
+ <img src="images/haze.st-radio_header.gif" width=494 height=75 alt="haze.st radio">
+ </td>
+ </tr>
+ <tr><td align="center"><font size="+2"><a href="listen128k.pls">128k</a> | <a href="listen24k.pls">24k</a></font></td></tr>
+ <tr><td align="center"><font size="+2">mirror: <a href="jmho-listen128k.pls">128k</a> | <a href="jmho-listen24k.pls">24k</a></font></td></tr>
+ <tr><td>
+ <tr><td> </td></tr>
+ <tr><th>chat: ICQ 113972341</th></tr>
+ <tr><td> </td></tr>
+ <tr><th>all times US/Pacific</th></tr>
+ <tr><td> </td></tr>
+<tr><td>
+ <table border=0>
+ <tr>
+ <th></th>
+ <th>Sunday</th>
+ <th>Monday</th>
+ <th>Tuesday</th>
+ <th>Wednesday</th>
+ <th>Thursday</th>
+ <th>Friday</th>
+ <th>Saturday</th>
+ </tr>
+ <tr>
+ <th><font size="-1">midnight</font></th>
+ <th rowspan="19" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="13" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="24" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="20" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="13" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="13" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ <th rowspan="24" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE<BR>AIR</th>
+ </tr>
+ <tr>
+ <th>1am</th>
+ </tr>
+ <tr>
+ <th>2am</th>
+ </tr>
+ <tr>
+ <th>3am</th>
+ </tr>
+ <tr>
+ <th>4am</th>
+ </tr>
+ <tr>
+ <th>5am</th>
+ </tr>
+ <tr>
+ <th>6am</th>
+ </tr>
+ <tr>
+ <th>7am</th>
+ </tr>
+ <tr>
+ <th>8am</th>
+ </tr>
+ <tr>
+ <th>9am</th>
+ </tr>
+ <tr>
+ <th>10am</th>
+ </tr>
+ <tr>
+ <th>11am</th>
+ </tr>
+ <tr>
+ <th>noon</th>
+ </tr>
+ <tr>
+ <th>1pm</th>
+ <th rowspan="3" bgcolor="#999966">High Jinx<BR><font size="-1">starts May 7th</font></th>
+ <th rowspan="3" bgcolor="#ffcc99"><a href="http://www.angelfire.com/rant/burf/oc.html">Organized<BR>Chaos</a><BR><font size="-1">rebroadcast 1pm-4pm</font></th>
+ <th rowspan="3" bgcolor="#ffcc99"><a href="http://www.theoverworld.com/echo/">Echo<BR>Communication<BR>System</a><BR><font size="-1">rebroadcast 1pm-4pm</font></th>
+ </tr>
+ <tr>
+ <th>2pm</th>
+ </tr>
+ <tr>
+ <th>3pm</th>
+ </tr>
+ <tr>
+ <th>4pm</th>
+ <th rowspan="8" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE <BR>AIR</th>
+ <th rowspan="3" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE <BR>AIR</th>
+ <th rowspan="8" bgcolor="#89201b" align="center"><font size="+1">OFF<BR>THE <BR>AIR</th>
+ </tr>
+ <tr>
+ <th>5pm</th>
+ </tr>
+ <tr>
+ <th>6pm</th>
+ </tr>
+ <tr>
+ <th>7pm</th>
+ <th rowspan="3" bgcolor="#999966">High Jinx<BR><FONT SIZE="-1">starts May 6th</font></th>
+ <th rowspan="3" bgcolor="#ffffcc"><a href="http://www.theoverworld.com/echo/">Echo<BR>Communication<BR>System</a><BR>LIVE 7pm-10pm</th>
+ </tr>
+ <tr>
+ <th>8pm</th>
+ <th rowspan="3" bgcolor="#ffffcc"><a href="http://www.angelfire.com/rant/burf/oc.html">Organized<BR>Chaos</a><BR>LIVE 8pm-11pm</th>
+ </tr>
+ <tr>
+ <th>9pm</th>
+ </tr>
+ <tr>
+ <th>10pm</th>
+ <th rowspan="2" bgcolor="#89201b" align="center">OFF THE AIR</th>
+ <th rowspan="2" bgcolor="#89201b" align="center">OFF THE AIR</th>
+ </tr>
+ <tr>
+ <th>11pm</th>
+ <th rowspan="1" bgcolor="#89201b" align="center">OFF THE AIR</th>
+ </table>
+</td></tr>
+ </table>\r
+ </td>\r
+ </tr>\r
+ </tr>\r
+</table>\r
+</BODY>\r
+</HTML>\r