]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Index.pm
Fix tons of JSLint issues.
[pr0n] / perl / Sesse / pr0n / Index.pm
index 6c7bc8079c7ef0bdc622f1f2c73ae37f63e3a31d..72fd824943d93ca9b460ba0a2cb756463b6fe4da 100644 (file)
@@ -115,17 +115,17 @@ sub handler {
 
                if ($model eq '') {
                        # no defined model
-                       $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE tag='Model' AND TRIM(value)<>'' )";
+                       $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE key='Model' AND TRIM(value)<>'' )";
                } else {
-                       $where .= " AND id IN ( SELECT image FROM exif_info WHERE tag='Model' AND TRIM(value)=$mq )";
+                       $where .= " AND id IN ( SELECT image FROM exif_info WHERE key='Model' AND TRIM(value)=$mq )";
                }
        
                # This doesn't match 1:1 if there's both lens and lensspec, but it should be OK in practice
                if ($lens eq '') {
                        # no defined lens
-                       $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE (tag='Lens' OR tag='LensSpec') AND TRIM(value)<>'' )";
+                       $where .= " AND id NOT IN ( SELECT image FROM exif_info WHERE (key='Lens' OR key='LensSpec') AND TRIM(value)<>'' )";
                } else {
-                       $where .= " AND id IN ( SELECT image FROM exif_info WHERE (tag='Lens' OR tag='LensSpec') AND TRIM(value)=$lq )";
+                       $where .= " AND id IN ( SELECT image FROM exif_info WHERE (key='Lens' OR key='LensSpec') AND TRIM(value)=$lq )";
                }
        }
 
@@ -173,8 +173,16 @@ sub handler {
        if ($settings{'fullscreen'}) {
                $r->content_type("text/html; charset=utf-8");
                Sesse::pr0n::Templates::print_template($r, "fullscreen-header", { title => "$name [$event]" });
+
+               my @files = ();
                while (my $ref = $q->fetchrow_hashref()) {
-                       $r->print("        [ \"" . $ref->{'event'} . "\", \"" . $ref->{'filename'} . "\" ],\n");
+                       push @files, [ $ref->{'event'}, $ref->{'filename'} ];
+               }
+               
+               for my $i (0..$#files) {
+                       $r->print("        [ \"" . $files[$i]->[0] . "\", \"" . $files[$i]->[1] . "\" ]");
+                       $r->print(",") unless ($i == $#files);
+                       $r->print("\n");
                }
 
                my %settings_no_fullscreen = %settings;
@@ -220,9 +228,9 @@ sub handler {
                                        COUNT(*) AS num
                                FROM ( SELECT * FROM images WHERE vhost=? $where ) 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 model.tag='Model'
+                                       LEFT JOIN ( SELECT * FROM exif_info WHERE key='Lens' ) lens ON i.id=lens.image
+                                       LEFT JOIN ( SELECT * FROM exif_info WHERE key='LensSpec') lens_spec ON i.id=lens_spec.image
+                               WHERE model.key='Model'
                                GROUP BY 1,2
                                ORDER BY 1,2")
                                or die "Couldn't prepare to find equipment: $!";