X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/e1c15e98e78002475bc637d1a5848b45414b9e41..refs/heads/master:/codec.plp diff --git a/codec.plp b/codec.plp index 2349b1d..f13b93a 100644 --- a/codec.plp +++ b/codec.plp @@ -4,43 +4,48 @@ my ($page, @feat) = split m{/+}, $Request || 'image'; $page !~ /\W/ or Html(), Abort('Invalid codec type request', 400); @feat or @feat = 'default'; my $title = "$page codecs"; +my $info = eval { Data("codec-$page") }; +if ($@) { + $info = {}; +} Html({ title => "$title cheat sheet", - version => '1.0', - description => [ - ], - keywords => [qw' - codec encoder encoding decode file format type mime - feature comparison support benchmark compression - image audio video - '], + version => '1.1', + description => $info->{intro}, + keywords => [@{ $info->{keywords} // [] }, qw' feature comparison support benchmark '], stylesheet => [qw'light circus dark red'], - data => [qw'codec.inc.pl'], - raw => '', + data => ["codec-$page.inc.pl"], + raw => '', }); -my $info = do "codec-$page.inc.pl"; -$info and %{$info} > 1 - or Abort("Requested codec type $page not available", '404 request not found', $@ // $!); +%{$info} + or Abort("Requested codec type $page not available", '404 request not found'); say "

\u$title

"; +say "

$_

" for $info->{intro} // (); my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']); :>
- -"; -print ''; + my @spans; + $spans[ $_->{generation} ]++ for @codeccols; + print "" for @spans; +} +say ''; +print ''; while (defined (my $feat = shift @feat)) { @@ -60,7 +65,7 @@ while (defined (my $feat = shift @feat)) { } } printf '';
feature <: my @codecs = sort { $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available} } keys $info->{codec}->%*; +my @codeccols = @{$info->{codec}}{@codecs}; -print '', $_->{name} for @{$info->{codec}}{@codecs}; -print "\n
', $_->{available} for @{$info->{codec}}{@codecs}; +{ + print '
'; +say "\t", '', $_->{name} for @codeccols; +print '
', $_->{available} for @codeccols; say '
', $data; } say '