Mercurial > hg > Members > kono > nitros9-code
comparison 3rdparty/utils/aaw/mkdskindex @ 2512:3dcda506604b
added pretty indexer to dskcopy process
author | aaronwolfe |
---|---|
date | Tue, 06 Apr 2010 01:20:16 +0000 |
parents | |
children | 05b648103e78 a711c2eecbbd |
comparison
equal
deleted
inserted
replaced
2511:5a29eed1ca2d | 2512:3dcda506604b |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # generate pretty index.html from directory of .dsks | |
4 # AAW 4/5/10 | |
5 | |
6 | |
7 $dirtoget=$ARGV[0]; | |
8 | |
9 opendir(DSKD, $dirtoget) || die("Cannot open directory"); | |
10 | |
11 @dsks=readdir(DSKD); | |
12 | |
13 &header; | |
14 | |
15 print "<TABLE class=tab1>"; | |
16 | |
17 print "<TR id='header'><TD class='h1'>File</td><TD class='h1'>Name</td><TD class='h1'>Size</td><TD class='h1'>Created</td><TD class='h1'>Sectors</td><TD class='h1'>Format</td></tr>"; | |
18 | |
19 foreach $dsk (sort @dsks) | |
20 { | |
21 | |
22 if ($dsk =~ m/.*\.dsk$/) | |
23 { | |
24 @os9id = `os9 id $dirtoget/$dsk`; | |
25 | |
26 foreach $line (@os9id) | |
27 { | |
28 if ($line =~ m/Disk\sname\s+:\s+(.*)/) | |
29 { | |
30 $name = $1; | |
31 } | |
32 elsif ($line =~ m/Disk\sformat\s+:.*\((.*)\)/) | |
33 { | |
34 $format = $1; | |
35 } | |
36 elsif ($line =~ m/Creation\sdate\s+:\s+(.*)/) | |
37 { | |
38 $created = $1; | |
39 } | |
40 elsif ($line =~ m/Total\ssectors\s+:\s+(.*)/) | |
41 { | |
42 $sectors = $1; | |
43 } | |
44 | |
45 | |
46 } | |
47 | |
48 if ($dsk =~ m/_dw3[\._]/) | |
49 { | |
50 $format = "DriveWire 3/4"; | |
51 } | |
52 | |
53 $size = -s "$dirtoget/$dsk"; | |
54 | |
55 $size = int($size / 1024) . "k"; | |
56 | |
57 print "<TR class='r1'>"; | |
58 print "<td class='d1'><A HREF=$dsk>$dsk</A></td>"; | |
59 print "<TD class='d1'>$name</td>"; | |
60 print "<TD class='d1'>$size</td>"; | |
61 print "<td class='d1'>$created</td>"; | |
62 print "<td class='d1'>$sectors</td>"; | |
63 print "<TD class='d1'>$format</TD>"; | |
64 print "</tr>\r\n"; | |
65 | |
66 } | |
67 } | |
68 | |
69 print "</TABLE>"; | |
70 | |
71 &footer; | |
72 | |
73 closedir(DSKD); | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 sub header | |
80 { | |
81 print "<HTML><HEAD><TITLE>Latest disk images</TITLE>"; | |
82 | |
83 print '<style type="text/css">'; | |
84 | |
85 print 'body { margin: 0px; padding 0px; }'; | |
86 print 'td.h1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; color: #FFFFFF; background-color: #444444; }'; | |
87 print 'td.d1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; }'; | |
88 print 'table.tab1 { margin: 10px; border-collapse:collapse;}'; | |
89 | |
90 print 'h4 { font-family: arial; padding: 10px;}'; | |
91 | |
92 print "</style>"; | |
93 | |
94 print "</HEAD><BODY>"; | |
95 print "<H4>NitrOS-9: Latest disk images</h4>"; | |
96 | |
97 } | |
98 | |
99 | |
100 sub footer | |
101 { | |
102 print "</BODY></HTML>"; | |
103 | |
104 | |
105 } |