]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Index.pm
Remove some really long-standing silliness: If we have no idea about width
[pr0n] / perl / Sesse / pr0n / Index.pm
index 30794557e868b2d4de43aa1b0927f63bd61fba06..74d5329d5cbc376207ae2e527b051c5202fa4f79 100644 (file)
@@ -199,13 +199,15 @@ sub handler {
 
                my @files = ();
                while (my $ref = $q->fetchrow_hashref()) {
-                       push @files, [ $ref->{'event'}, $ref->{'filename'} ];
+                       my $width = defined($ref->{'width'}) ? $ref->{'width'} : -1;
+                       my $height = defined($ref->{'height'}) ? $ref->{'height'} : -1;
+                       push @files, [ $ref->{'event'}, $ref->{'filename'}, $width, $height ];
                }
                
                for my $i (0..$#files) {
-                       $r->print("        [ \"" . $files[$i]->[0] . "\", \"" . $files[$i]->[1] . "\" ]");
-                       $r->print(",") unless ($i == $#files);
-                       $r->print("\n");
+                       my $line = sprintf "        [ \"%s\", \"%s\", %d, %d ]", @{$files[$i]};
+                       $line .= "," unless ($i == $#files);
+                       $r->print($line . "\n");
                }
 
                my %settings_no_fullscreen = %settings;
@@ -366,7 +368,7 @@ sub handler {
                                }
                        }
 
-                       if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
+                       if (defined($ref->{'width'}) && defined($ref->{'height'})) {
                                my $width = $ref->{'width'};
                                my $height = $ref->{'height'};