annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2512
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
1 #!/usr/bin/perl
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
2
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
3 # generate pretty index.html from directory of .dsks
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
4 # AAW 4/5/10
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
5
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
6
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
7 $dirtoget=$ARGV[0];
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
8
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
9 opendir(DSKD, $dirtoget) || die("Cannot open directory");
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
10
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
11 @dsks=readdir(DSKD);
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
12
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
13 &header;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
14
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
15 print "<TABLE class=tab1>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
16
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
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>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
18
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
19 foreach $dsk (sort @dsks)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
20 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
21
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
22 if ($dsk =~ m/.*\.dsk$/)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
23 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
24 @os9id = `os9 id $dirtoget/$dsk`;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
25
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
26 foreach $line (@os9id)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
27 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
28 if ($line =~ m/Disk\sname\s+:\s+(.*)/)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
29 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
30 $name = $1;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
31 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
32 elsif ($line =~ m/Disk\sformat\s+:.*\((.*)\)/)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
33 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
34 $format = $1;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
35 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
36 elsif ($line =~ m/Creation\sdate\s+:\s+(.*)/)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
37 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
38 $created = $1;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
39 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
40 elsif ($line =~ m/Total\ssectors\s+:\s+(.*)/)
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
41 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
42 $sectors = $1;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
43 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
44
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
45
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
46 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
47
2934
0bd529f1d860 Update mkdskimage script to recognize DW images
Tormod Volden <debian.tormod@gmail.com>
parents: 2898
diff changeset
48 if ($dsk =~ m/_dw[\._]/)
2512
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
49 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
50 $format = "DriveWire 3/4";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
51 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
52
2760
a711c2eecbbd Updated mkdskindex to correct state that the becker disks are a DriveWire 3/4 disk rather than being a standard floppy disk image.
drencor-xeen
parents: 2512
diff changeset
53 if ($dsk =~ m/_becker[\._]/)
a711c2eecbbd Updated mkdskindex to correct state that the becker disks are a DriveWire 3/4 disk rather than being a standard floppy disk image.
drencor-xeen
parents: 2512
diff changeset
54 {
a711c2eecbbd Updated mkdskindex to correct state that the becker disks are a DriveWire 3/4 disk rather than being a standard floppy disk image.
drencor-xeen
parents: 2512
diff changeset
55 $format = "DriveWire 3/4";
a711c2eecbbd Updated mkdskindex to correct state that the becker disks are a DriveWire 3/4 disk rather than being a standard floppy disk image.
drencor-xeen
parents: 2512
diff changeset
56 }
a711c2eecbbd Updated mkdskindex to correct state that the becker disks are a DriveWire 3/4 disk rather than being a standard floppy disk image.
drencor-xeen
parents: 2512
diff changeset
57
2860
8bd3a42345b2 mkdskindex: Detect and tag CoCo SDC disk images
Tormod Volden <debian.tormod@gmail.com>
parents: 2774
diff changeset
58 if ($dsk =~ m/_cocosdc[\._]/)
8bd3a42345b2 mkdskindex: Detect and tag CoCo SDC disk images
Tormod Volden <debian.tormod@gmail.com>
parents: 2774
diff changeset
59 {
8bd3a42345b2 mkdskindex: Detect and tag CoCo SDC disk images
Tormod Volden <debian.tormod@gmail.com>
parents: 2774
diff changeset
60 $format = "CoCo SDC";
8bd3a42345b2 mkdskindex: Detect and tag CoCo SDC disk images
Tormod Volden <debian.tormod@gmail.com>
parents: 2774
diff changeset
61 }
8bd3a42345b2 mkdskindex: Detect and tag CoCo SDC disk images
Tormod Volden <debian.tormod@gmail.com>
parents: 2774
diff changeset
62
2512
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
63 $size = -s "$dirtoget/$dsk";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
64
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
65 $size = int($size / 1024) . "k";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
66
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
67 print "<TR class='r1'>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
68 print "<td class='d1'><A HREF=$dsk>$dsk</A></td>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
69 print "<TD class='d1'>$name</td>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
70 print "<TD class='d1'>$size</td>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
71 print "<td class='d1'>$created</td>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
72 print "<td class='d1'>$sectors</td>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
73 print "<TD class='d1'>$format</TD>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
74 print "</tr>\r\n";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
75
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
76 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
77 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
78
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
79 print "</TABLE>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
80
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
81 &footer;
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
82
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
83 closedir(DSKD);
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
84
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
85
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
86
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
87
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
88
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
89 sub header
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
90 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
91 print "<HTML><HEAD><TITLE>Latest disk images</TITLE>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
92
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
93 print '<style type="text/css">';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
94
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
95 print 'body { margin: 0px; padding 0px; }';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
96 print 'td.h1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; color: #FFFFFF; background-color: #444444; }';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
97 print 'td.d1 { font-family: arial; padding: 5px; padding-right: 10px; font-size:12px; }';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
98 print 'table.tab1 { margin: 10px; border-collapse:collapse;}';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
99
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
100 print 'h4 { font-family: arial; padding: 10px;}';
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
101
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
102 print "</style>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
103
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
104 print "</HEAD><BODY>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
105 print "<H4>NitrOS-9: Latest disk images</h4>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
106
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
107 }
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
108
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
109
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
110 sub footer
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
111 {
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
112 print "</BODY></HTML>";
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
113
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
114
3dcda506604b added pretty indexer to dskcopy process
aaronwolfe
parents:
diff changeset
115 }