]> git.sesse.net Git - pr0n/commitdiff
For pictures taken on manual, set both aperture and shutter as bold.
authorSteinar H. Gunderson <sesse@debian.org>
Mon, 19 Jul 2010 12:55:22 +0000 (14:55 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Mon, 19 Jul 2010 12:55:22 +0000 (14:55 +0200)
perl/Sesse/pr0n/Common.pm

index d325907b71395e57298499b8718c9f5f8f480a64..ad905d1e5d6f03e6563d6512ecee8213e4d951f2 100644 (file)
@@ -863,10 +863,14 @@ sub make_infobox {
        # fields"; note the comma separation. Every field has an associated "bold flag"
        # in the second part.
        
-       my $shutter_priority = (defined($info->{'ExposureProgram'}) &&
+       my $manual_shutter = (defined($info->{'ExposureProgram'}) &&
                $info->{'ExposureProgram'} =~ /shutter\b.*\bpriority/i);
-       my $aperture_priority = (defined($info->{'ExposureProgram'}) &&
+       my $manual_aperture = (defined($info->{'ExposureProgram'}) &&
                $info->{'ExposureProgram'} =~ /aperture\b.*\bpriority/i);
+       if ($info->{'ExposureProgram'} =~ /manual/i) {
+               $manual_shutter = 1;
+               $manual_aperture = 1;
+       }
 
        my @classic_fields = ();
        if (defined($info->{'FocalLength'}) && $info->{'FocalLength'} =~ /^(\d+)(?:\.\d+)?\s*(?:mm)?$/) {
@@ -878,24 +882,24 @@ sub make_infobox {
        if (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+)\/(\d+)$/) {
                my ($a, $b) = ($1, $2);
                my $gcd = gcd($a, $b);
-               push @classic_fields, [ $a/$gcd . "/" . $b/$gcd . "s", $shutter_priority ];
+               push @classic_fields, [ $a/$gcd . "/" . $b/$gcd . "s", $manual_shutter ];
        } elsif (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+(?:\.\d+)?)$/) {
-               push @classic_fields, [ $1 . "s", $shutter_priority ];
+               push @classic_fields, [ $1 . "s", $manual_shutter ];
        }
 
        if (defined($info->{'FNumber'}) && $info->{'FNumber'} =~ /^(\d+)\/(\d+)$/) {
                my $f = $1/$2;
                if ($f >= 10) {
-                       push @classic_fields, [ (sprintf "f/%.0f", $f), $aperture_priority ];
+                       push @classic_fields, [ (sprintf "f/%.0f", $f), $manual_aperture ];
                } else {
-                       push @classic_fields, [ (sprintf "f/%.1f", $f), $aperture_priority ];
+                       push @classic_fields, [ (sprintf "f/%.1f", $f), $manual_aperture ];
                }
        } elsif (defined($info->{'FNumber'}) && $info->{'FNumber'} =~ /^(\d+)\.(\d+)$/) {
                my $f = $info->{'FNumber'};
                if ($f >= 10) {
-                       push @classic_fields, [ (sprintf "f/%.0f", $f), $aperture_priority ];
+                       push @classic_fields, [ (sprintf "f/%.0f", $f), $manual_aperture ];
                } else {
-                       push @classic_fields, [ (sprintf "f/%.1f", $f), $aperture_priority ];
+                       push @classic_fields, [ (sprintf "f/%.1f", $f), $manual_aperture ];
                }
        }