]>
git.gir.st - ttxd.git/blob - src/vtx2ascii-src/vtx.cgi
5 $SPOOL="/home/kraxel/vtx";
6 $VTX2ASCII="/home/kraxel/bin/vtx2ascii";
8 #######################################################################
11 @WEEK = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
12 @MON = ('Jan','Feb','Mar','Apr','May','Jun',
13 'Jul','Aug','Sep','Oct','Nov','Dec');
17 sprintf ("%s, %02d %s %04d %02d:%02d:%02d GMT",
18 $WEEK[$tm[6]],$tm[3],$MON[$tm[4]],$tm[5]+1900,$tm[2],$tm[1],$tm[0]);
21 #######################################################################
25 local($title,$file) = @_;
29 printf("Last-modified: %s\n",time2str
(@inode[9]));
32 Content-Type: text/html
36 <title>videotext: $title</title>
38 <body bgcolor=white color=black link=royalblue vlink=darkblue>
43 print "</body></html>\n";
50 print "<h2>PANIC</h2>$text";
62 #######################################################################
67 if ($cgi->path_info eq "" || $cgi->path_info =~ /^\/[^\
/]+$/) {
68 print $cgi->redirect($cgi->url . $cgi->path_info . "/");
71 ($dummy,$station,$page) = split(/\//,$cgi->path_info);
73 # entry page - station list
74 if ($station !~ /\S/) {
75 opendir DIR
, $SPOOL || panic
("can't open dir $SPOOL: $@");
76 &start_page
("station list",$SPOOL);
77 print "<h2>station list</h2>\n<ul>\n";
78 while ($file = readdir(DIR
)) {
79 next if ($file =~ /^\./);
80 next unless -d
"$SPOOL/$file";
81 print "<li><a href=\"$file/\">$file</a
>\n";
88 # station dir - spage list
90 opendir DIR, "$SPOOL/$station" ||
91 panic("can
't open dir $SPOOL/$station: $@");
92 &start_page("$station - page list","$SPOOL/$station");
93 print "<h2>$station - page list</h2>\n\n";
94 print "<a href=\"../\">[station list]</a><hr noshade><ul>\n";
95 while ($file = readdir(DIR)) {
96 next unless ($file =~ /\.vtx/);
97 print "<li><a href=\"$file\">$file</a>\n";
105 unless (-f "$SPOOL/$station/$page") {
107 if ($page =~ s/_00.vtx/_01.vtx/ && -f "$SPOOL/$station/$page") {
108 print $cgi->redirect($cgi->url . "/$station/$page");
111 panic("$SPOOL/$station/$page: not found");
116 open VTX,"$VTX2ASCII -h $SPOOL/$station/$page |" ||
117 panic("can't run
$VTX2ASCII: $@");
122 $data =~ s/(\d\d\d)/&addlink($1)/eg;
125 start_page("$station - $page","$SPOOL/$station/$page");
126 print "<h2
>$station - $page</h2
>\n";
127 print "<a href
=\"../\">[station list]</a>  
; ";
128 print "<a href
=\"./\">[page list]</a>  
; ";
129 if ($page =~ /(\d\d\d)_(\d\d).vtx/ && $2 > 0) {
130 printf "<a href
=\"%03d_%02d.vtx
\">[prev subpage
]</a
>  
; ",$1,$2-1;
131 printf "<a href
=\"%03d_%02d.vtx
\">[next subpage
]</a
>  
; ",$1,$2+1;
134 foreach $item (sort keys %links) {
135 print "<a href
=\"${item
}_00
.vtx
\">$item</a
>\n";
137 print "<hr noshade
>\n";