]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Improve flash/no flash detection.
[pr0n] / perl / Sesse / pr0n / Common.pm
index 76da6befeb3466f6620f354ad5a8ef251b7f99a6..c6f1c5b59fb87b89c375cde62b3967178dbe4ed8 100644 (file)
@@ -192,8 +192,8 @@ sub update_width_height {
 
        # update the last_picture cache as well (this should of course be done
        # via a trigger, but this is less complicated :-) )
-       $dbh->do('UPDATE events SET last_picture=(SELECT COALESCE(MAX(date),\'1970-01-01 00:00:00\') FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
-               undef, $id)
+       $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
+               undef, $datetime, $id)
                or die "Couldn't update last_picture in SQL: $!";
 }
 
@@ -438,9 +438,11 @@ sub make_infobox {
        }
 
        if (defined($info->{'Flash'})) {
-               if ($info->{'Flash'} =~ /did not fire/ || $info->{'Flash'} =~ /No Flash/) {
+               if ($info->{'Flash'} =~ /did not fire/i ||
+                   $info->{'Flash'} =~ /no flash/i ||
+                   $info->{'Flash'} =~ /not fired/i)  {
                        push @lines, "No flash";
-               } elsif ($info->{'Flash'} =~ /fired/) {
+               } elsif ($info->{'Flash'} =~ /fired/i) {
                        push @lines, "Flash";
                } else {
                        push @lines, $info->{'Flash'};