Mercurial > hg > Members > kono > nitros9-code
comparison scripts/mkdskindex @ 2962:1e0ca35dcee0
Move mkdskindex into scripts folder
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 09 Feb 2014 23:46:50 +0100 |
parents | 3rdparty/utils/aaw/mkdskindex@0bd529f1d860 |
children | 96af4bcea625 |
comparison
equal
deleted
inserted
replaced
2961:061bb0ed9c16 | 2962:1e0ca35dcee0 |
---|---|
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/_dw[\._]/) | |
49 { | |
50 $format = "DriveWire 3/4"; | |
51 } | |
52 | |
53 if ($dsk =~ m/_becker[\._]/) | |
54 { | |
55 $format = "DriveWire 3/4"; | |
56 } | |
57 | |
58 if ($dsk =~ m/_cocosdc[\._]/) | |
59 { | |
60 $format = "CoCo SDC"; | |
61 } | |
62 | |
63 $size = -s "$dirtoget/$dsk"; | |
64 | |
65 $size = int($size / 1024) . "k"; | |
66 | |
67 print "<TR class='r1'>"; | |
68 print "<td class='d1'><A HREF=$dsk>$dsk</A></td>"; | |
69 print "<TD class='d1'>$name</td>"; | |
70 print "<TD class='d1'>$size</td>"; | |
71 print "<td class='d1'>$created</td>"; | |
72 print "<td class='d1'>$sectors</td>"; | |
73 print "<TD class='d1'>$format</TD>"; | |
74 print "</tr>\r\n"; | |
75 | |
76 } | |
77 } | |
78 | |
79 print "</TABLE>"; | |
80 | |
81 &footer; | |
82 | |
83 closedir(DSKD); | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 sub header | |
90 { | |
91 print "<HTML><HEAD><TITLE>Latest disk images</TITLE>"; | |
92 | |
93 print '<style type="text/css">'; | |
94 | |
95 print 'body { margin: 0px; padding 0px; }'; | |
96 print 'td.h1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; color: #FFFFFF; background-color: #444444; }'; | |
97 print 'td.d1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; }'; | |
98 print 'table.tab1 { margin: 10px; border-collapse:collapse;}'; | |
99 | |
100 print 'h4 { font-family: arial; padding: 10px;}'; | |
101 | |
102 print "</style>"; | |
103 | |
104 print "</HEAD><BODY>"; | |
105 print "<H4>NitrOS-9: Latest disk images</h4>"; | |
106 | |
107 } | |
108 | |
109 | |
110 sub footer | |
111 { | |
112 print "</BODY></HTML>"; | |
113 | |
114 | |
115 } |