summaryrefslogtreecommitdiffstats
path: root/www/dailymod.pl
blob: 9e3d118ba2bc4e2ace6be2aa4166bef61c396c89 (plain)
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
#!/usr/bin/perl

require "rockbox.pm";

my $basedir = "/home/dast/rockbox-build/daily-build";

my @list=("player",
          "recorder", "recorder8mb",
          "fmrecorder", "fmrecorder8mb",
          "recorderv2",
          "ondiofm", "ondiosp",
          "h100", "h120", "h300", "ipodcolor", "ipodnano",

          # install and source are special cases
          "install", "source");

for(@list) {
    my $dir = $_;
    opendir(DIR, "$basedir/$dir") or next;
    my @files = sort grep { /^rockbox/ } readdir(DIR);
    closedir DIR;

    for(@files) {
        /(20\d+)/;
        $date{$1}=$1;
    }
}

for(reverse sort keys %date) {
    my $d = $_;
    my $nice = $d;
    if($d =~ /(\d\d\d\d)(\d\d)(\d\d)/) {
        $nice = "$1-$2-$3";
    }
    print "<table class=rockbox cellpadding=\"0\"><tr valign=top>\n";

    $color1 -= 0x18;
    $color2 -= 0x18;
    $color3 -= 0x18;
    
    my $count = 0;
    my $split = int((scalar @list) / 2);
    my $x = 0;
    my @head;

    foreach $t (@list) {
        my $show = $t;
        $show =~ s/recorder/rec/;
        # Remove the comment below to get long names
        # $show = $longname{$t};
        $head[$x] .= "<th>$show</th>\n";
	$count++;
	if ($count == $split) {
	    $x++;
	}
    }
    print "$head[0]</tr><tr>\n";

    $count = 0;
    for(@list) {
        my $m = $_;
        printf "<td><img alt=\"$m\" src=\"$model{$m}\"><br>";
        # new-style full zip:
        my $file = "rockbox-${m}-${d}.zip";
        if($m eq "source") {
            $file = "rockbox-daily-${d}.tar.gz";
        }
        elsif($m eq "install") {
            $file = "Rockbox-${d}-install.exe";
        }
        if( -f "$basedir/$m/$file") {
            printf "<a href=\"/daily/$_/$file\">latest</a>",
        }
        print "<p><a href=\"/dl.cgi?bin=$_\">older</a></td>\n";

	$count++;
	if ($count == $split) {
	    print "</tr><tr>$head[1]</tr><tr>\n";
	}
    }
    print "</tr>\n";
    last;
}
print "</table>\n";