X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FIndex.pm;h=737eba6e7f908a42fa0cd7a57d225297ff919ee2;hp=f8f44048ff385a6bdfaa3ed5f506b84fcd8d0f7f;hb=d4f0d9ec6819c2b84289193021c74c9220d084ed;hpb=a5c13b107460a55b50424d6c6bd6a77abf71300d;ds=sidebyside diff --git a/perl/Sesse/pr0n/Index.pm b/perl/Sesse/pr0n/Index.pm index f8f4404..737eba6 100644 --- a/perl/Sesse/pr0n/Index.pm +++ b/perl/Sesse/pr0n/Index.pm @@ -155,14 +155,16 @@ sub handler { # Find the equipment used my $eq = $dbh->prepare(' - SELECT DISTINCT + SELECT model.value AS model, - coalesce(lens_spec.value, lens.value) AS lens + coalesce(lens_spec.value, lens.value) AS lens, + COUNT(*) AS num FROM images i LEFT JOIN exif_info model ON i.id=model.image LEFT JOIN ( SELECT * FROM exif_info WHERE tag=\'Lens\' ) lens ON i.id=lens.image LEFT JOIN ( SELECT * FROM exif_info WHERE tag=\'LensSpec\') lens_spec ON i.id=lens_spec.image WHERE event=? AND model.tag=\'Model\' + GROUP BY 1,2 ORDER BY 1,2') or die "Couldn't prepare to find equipment: $!"; $eq->execute($event) @@ -175,8 +177,9 @@ sub handler { # # Some compact cameras seem to add lens info sometimes and not at other # times; if we have seen a camera with at least one specific lens earlier, - # just ignore entries without a lens. + # just combine entries without a lens with the previous one. # + $equipment[$#equipment]->{'num'} += $ref->{'num'}; next; } push @equipment, $ref; @@ -187,11 +190,14 @@ sub handler { if (scalar @equipment > 0) { Sesse::pr0n::Templates::print_template($r, "equipment-start"); for my $e (@equipment) { - $r->print("