forked from DeaDBeeF-Player/deadbeef-plugin-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-md
executable file
·70 lines (58 loc) · 2.02 KB
/
build-md
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
#!/usr/bin/env perl
use strict;
use warnings;
my @packages = split (/\n/, `ls plugins`);
mkdir 'temp';
mkdir 'temp/output';
mkdir 'temp/output/web';
my $fname = 'temp/output/web/plugins.md';
open F,">$fname" || die "Failed to open $fname\n";
print F "<table><tr><th>Name</th><th>Revision</th><th>Download</th><th>Description</th></tr>\n";
foreach (@packages) {
my %conf = ();
my $package = $_;
my $descr_fname = "temp/output/i686/$package.descr";
if (-e $descr_fname) {
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) {
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);
}
if (exists $conf{name}) {
my $descr = $conf{descr};
$descr =~ s/\n/<br\/>/g;
my $links = '';
if ($conf{fname_i686}) {
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/i686/$conf{fname_i686}/download'>i686</a>";
}
if ($conf{fname_x86_64}) {
if ($conf{fname_i686}) {
$links .= '<br/>';
}
$links .= "<a href='http://sourceforge.net/projects/deadbeef/files/plugins/x86_64/$conf{fname_x86_64}/download'>x86_64</a>";
}
print F "<tr><td valign='top'>$conf{name}</td><td valign='top'>$conf{revision}</td><td valign='top'> $links</td><td valign='top'>$descr<br/>[<a href=\"$conf{website}\">Author's website</a>]</td></tr>\n";
}
else {
print STDERR "skipping plugin $package (bad .descr)\n";
}
}
print F "</table>\n";
close F;
sub parse_config {
$_ = shift;
my %out;
while (/([a-z_0-9]*)="([^"]*)"\n/g) {
$out{$1} = $2;
}
return %out;
}