-
Notifications
You must be signed in to change notification settings - Fork 14
/
build-html
executable file
·110 lines (96 loc) · 3.5 KB
/
build-html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my @packages = split (/\n/, `ls plugins`);
mkdir 'temp';
mkdir 'temp/output';
mkdir 'temp/output/web';
my $fname = 'temp/output/web/plugins-content.html';
open F,">$fname" || die "Failed to open $fname\n";
print F "<table class='table'><tr><th scope='col'>Name</th><th scope='col'>Revision</th><th scope='col'>Download</th><th scope='col'>Description</th></tr>\n";
foreach (@packages) {
my %conf = ();
my $package = $_;
my $descr_fname = "temp/output/i686/$package.descr";
if (-e $descr_fname) {
print "Found $descr_fname\n";
local $/;
open CONF,"<$descr_fname" || die "Failed to open $descr_fname\n";
my %i686_conf = parse_config (<CONF>);
close CONF;
map ({$conf{$_} = $i686_conf{$_}} keys %i686_conf);
}
$descr_fname = "temp/output/x86_64/$package.descr";
if (-e $descr_fname) {
print "Found $descr_fname\n";
local $/;
open CONF,"<$descr_fname" || die "Failed to open $descr_fname\n";
my %x86_64_conf = parse_config (<CONF>);
close CONF;
map ({$conf{$_} = $x86_64_conf{$_}} keys %x86_64_conf);
}
$descr_fname = "temp/output/universal/$package.descr";
if (-e $descr_fname) {
print "Found $descr_fname\n";
local $/;
open CONF,"<$descr_fname" || die "Failed to open $descr_fname\n";
my %x86_64_conf = parse_config (<CONF>);
close CONF;
map ({$conf{$_} = $x86_64_conf{$_}} keys %x86_64_conf);
}
print "Plugin descr:\n" . Dumper (\%conf) . "\n";
if (exists $conf{name}) {
print "reading $conf{name}\n";
my $descr = $conf{descr};
if (!$descr) {
print "null descr!\n";
print Dumper(\%conf)."\n";
next;
}
$descr =~ s/\n/<br\/>/g;
my $links = '';
if ($conf{fname_linux_i686}) {
if ($links) {
$links .= '<br/>';
}
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/i686/$conf{fname_linux_i686}/download'>Linux (i686)</a>";
}
if ($conf{fname_linux_x86_64}) {
if ($links) {
$links .= '<br/>';
}
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/x86_64/$conf{fname_linux_x86_64}/download'>Linux</a>";
}
if ($conf{fname_mac_universal}) {
if ($links) {
$links .= '<br/>';
}
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/mac/$conf{fname_mac_universal}/download'>Mac (Universal)</a>";
}
if ($conf{fname_windows_x86_64}) {
if ($links) {
$links .= '<br/>';
}
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/x86_64/$conf{fname_windows_x86_64}/download'>Windows</a>";
}
print F "<tr><td scope='row' valign='top'><a href='$conf{website}'>$conf{name}</a></td><td scope='row' valign='top'>$conf{revision}</td><td scope='row' valign='top'> $links</td><td scope='row' valign='top'>$descr</td></tr>\n";
}
else {
print STDERR "skipping plugin $package (bad .descr)\n";
}
}
print F "</table>\n";
close F;
sub parse_config {
$_ = shift;
s/\\"/"/g;
my %out;
while (/([a-z_0-9]*)="([^"]*)"\n/g) {
my $key = $1;
my $val = $2;
$val =~ s/"/"/g;
$out{$key} = $val;
}
return %out;
}