X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/433d74a7369648a5a005b8678d005d85fe1dfac1..004e069b46889f35372bc73615dc9a163a0f297b:/codec.plp diff --git a/codec.plp b/codec.plp index 2cc454a..2e50794 100644 --- a/codec.plp +++ b/codec.plp @@ -1,5 +1,7 @@ <(common.inc.plp)><: +my @feat = split m{/+}, $Request || 'default'; + Html({ title => 'Codecs', version => '1.0', @@ -14,13 +16,13 @@ Html({ my $info = do 'codec.inc.pl'; $info and %{$info} > 1 or Abort("cannot open operator include", 500, $@ // $!); -my %BOOLSCORE = (y => 5, n => 1); +my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']); :>

Image codecs

- + "; print ''; -print ''; -for my $feat (sort keys %{$info->{feature}}) { - my $featinfo = $info->{feature}->{$feat}; +while (defined (my $feat = shift @feat)) { + my $featinfo = $info->{feature}->{$feat} or next; + unshift @feat, @{$_} for $featinfo->{children} // (); + $featinfo->{score} or next; + print '' if $featinfo->{children}; printf ''; }
feature <: my @codecs = sort { @@ -32,16 +34,26 @@ print "\n
', $_->{available} for @{$info->{codec}}{@codecs}; say '
%s', $featinfo->{name} // $feat; - printf('%s', - (map { $_ && $BOOLSCORE{$_} || $_ || 0 } $featinfo->{score}->{$_}), - $featinfo->{data}->{$_} // (map { - $BOOLSCORE{$_} ? ($_ eq 'y' ? '✔' : '✘') : '•' x ($_ - 1) - } $featinfo->{score}->{$_}), - ) for @codecs; + for (@codecs) { + my ($score, $data, $title) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_}; + if (not defined $data) { + if (my $override = $BOOLSCORE{$score}) { + ($score, $data) = @{$override}; + } + else { + $data = '•' x ($score - 1); + } + } + printf '', $data; + } say '