3 $template_file = "/home/ivan/radio.haze.st/template.html";
10 'upcoming' => '999966',
12 'rebroadcast' => 'ffcc99',
17 'name' => 'High Jinx',
22 'startdate' => 'May 6th',
24 'high_jinx_rebroadcast' => {
25 'name' => 'High Jinx',
30 'startdate' => 'May 7th',
33 'name' => 'Dub Monday',
37 'url' => 'http://www.voyager.org/sets',
40 'dub_monday_rebroadcast' => {
41 'name' => 'Dub Monday',
45 'url' => 'http://www.voyager.org/sets',
46 'type' => 'rebroadcast',
48 'organized_chaos' => {
49 #'name' => 'Organized<BR>Chaos',
50 'name' => 'Organized Chaos',
54 'url' => 'http://www.angelfire.com/rant/burf/oc.html',
57 'organized_chaos_rebroadcast' => {
58 #'name' => 'Organized<BR>Chaos',
59 'name' => 'Organized Chaos',
63 'url' => 'http://www.angelfire.com/rant/burf/oc.html',
64 'type' => 'rebroadcast',
66 'echo_communication_system' => {
67 #'name' => 'Echo<BR>Communication<BR>System',
68 #'name' => 'Echo Communication System',
69 'name' => 'Echo Communication System',
73 'url' => 'http://www.theoverworld.com/echo/',
76 'echo_communication_system__rebroadcast' => {
77 #'name' => 'Echo<BR>Communication<BR>System',
78 #'name' => 'Echo Communication System',
79 'name' => 'Echo Communication System',
83 'url' => 'http://www.theoverworld.com/echo/',
84 'type' => 'rebroadcast',
88 @times = qw( midnight 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am 11am noon 1pm
89 2pm 3pm 4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm );
94 if ( defined($cgi->param('showstart'))
95 && $cgi->param('showstart') =~ /^(\d+)$/ ) {
100 @showtimes = @times[$showstart..23];
102 $template = new Text::Template ( TYPE => 'FILE', SOURCE => $template_file )
103 or die "Can't create template for $template_file: $Text::Template::ERROR";
105 my $text = $template->fill_in()
106 or die "Can't fill in template for $template_file: $Text::Template::ERROR";
108 print $cgi->header, $text;
110 # subroutines for the template
114 my $rows = 1 + scalar(@showtimes)*(1/$increment);
116 my $table = new HTML::Table($rows+20,8+2);
117 # $table->setBorder(0);
118 $table->setCellSpacing('0');
119 $table->setCellPadding('1');
122 foreach my $day ( map "${_}day", qw( Sun Mon Tues Wednes Thurs Fri Satur ) ) {
123 $table->setCell(1, $daycol, "<B>${day}</B>" );
124 $table->setCellAlign(1, $daycol, 'CENTER');
127 sort { $shows{$a}{'start'} <=> $shows{$b}{'start'} }
128 grep { lc($shows{$_}{day}) eq lc($day) } keys %shows;
130 foreach my $show ( @dayshows ) {
132 my $text = "<B>$shows{$show}{name}</B>";
133 $text = qq(<A HREF="$shows{$show}{url}">$text</A>)
134 if exists $shows{$show}{url};
135 if ( $shows{$show}{type} eq 'upcoming' ) {
136 $text .= qq(<BR><FONT SIZE="-1">starts $shows{$show}{startdate}</FONT>);
137 #$text .= '<BR><FONT SIZE="-1">starts May Xth</FONT>';
139 if ( $shows{$show}{type} eq 'live' ) {
140 $text .= "<BR><B>LIVE</B> ";
142 if ( $shows{$show}{type} eq 'rebroadcast' ) {
143 #$text .= "<BR><B>rebroadcast</B> ";
144 $text .= qq(<BR><FONT SIZE="-1">rebroadcast</FONT> );
146 if ( $shows{$show}{type} =~ /^(live|rebroadcast)$/ ) {
147 my $start = $shows{$show}{start};
148 my $stext = $times[ $start ];
149 $stext =~ s/([0-9])([ap]m)/$1:30$2/ if $start != int($start);
150 my $end = $shows{$show}{start} + $shows{$show}{len};
151 my $etext = $times[$end];
152 $etext =~ s/([0-9])([ap]m)/$1:30$2/ if $end != int($end);
153 #$text .= "<B>$stext-$etext</B>";
154 $text .= qq(<FONT SIZE="-1">$stext-$etext</FONT>);
157 my $showrow = 2 + (1/$increment) * ( $shows{$show}{start} - $showstart);
159 if ( $pshowrow < $showrow ) {
160 #$table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>'. "($showrow/$pshowrow) ".($showrow-$pshowrow));
161 $table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>');
162 $table->setCellAlign($pshowrow, $daycol, 'CENTER');
163 $table->setCellRowSpan( $pshowrow, $daycol, $showrow-$pshowrow );
164 #$table->setCellRowSpan( $pshowrow, $daycol, 1 );
165 $table->setCellBGColor( $pshowrow, $daycol, '89201b' );
167 $table->setCell($showrow, $daycol, $text );
168 $table->setCellAlign($showrow, $daycol, 'CENTER');
169 $table->setCellBGColor($showrow, $daycol,
170 $type2color{$shows{$show}{type}});
171 my $span = $shows{$show}{len} * (1/$increment);
172 $table->setCellRowSpan($showrow, $daycol, $span );
174 $pshowrow=$showrow+$span;
177 if ( $pshowrow < $rows+1 ) {
178 #$table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>'. "($rows+1/$pshowrow) ".($rows+1-$pshowrow));
179 $table->setCell($pshowrow, $daycol, '<B>OFF THE AIR</B>');
180 $table->setCellAlign($pshowrow, $daycol, 'CENTER');
181 $table->setCellRowSpan( $pshowrow, $daycol, $rows+1-$pshowrow );
182 #$table->setCellRowSpan( $pshowrow, $daycol, 2 );
183 $table->setCellBGColor( $pshowrow, $daycol, '89201b' );
190 foreach my $time ( @showtimes ) {
192 $text = qq(<FONT SIZE="-1">$text</FONT>) if length($text) > 4;
193 $table->setCell( $timerow, 1, "<B>$text</B>" );
194 $table->setCellAlign( $timerow, 1, 'CENTER' );
195 $table->setCellRowSpan( $timerow, 1, 1/$increment );
196 #$table->setCell( $timerow+1, 1, "<B>$text:30</B>" );
197 # $table->setCell( $timerow+1, 1, " " );
198 # $table->setCellAlign( $timerow+1, 1, 'CENTER' );
199 $timerow += 1/$increment;
203 my $html = $table->getTable;
204 $html =~ s/<! spanned cell\)>//g;