]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Try XMP-dc:Subject if Keywords does not work. Patch from xim.
[pr0n] / perl / Sesse / pr0n / Common.pm
index a9ee2119db8751d3c97770f5cb6f7aa68f9864e0..7375c3cf8f8174a0e90d5753295b1f87895977c5 100644 (file)
@@ -233,7 +233,7 @@ sub get_cache_location {
 
 sub ensure_disk_location_exists {
        my ($r, $id) = @_;
-        my $dir = POSIX::floor($id / 256);
+       my $dir = POSIX::floor($id / 256);
 
        my $img_dir = get_base($r) . "/images/$dir/";
        if (! -d $img_dir) {
@@ -308,6 +308,10 @@ sub update_image_info {
                
                # Tags
                my @tags = $exiftool->GetValue('Keywords', 'ValueConv');
+               if (scalar @tags == 0) {
+                       # This is XMP-dc:Subject, an RDF bag of tags.
+                       @tags = $exiftool->GetValue('Subject', 'ValueConv');
+               }
                $dbh->do('DELETE FROM tags WHERE image=?',
                        undef, $id)
                        or die "Couldn't delete old tag information in SQL: $!";
@@ -1117,8 +1121,6 @@ sub purge_cache {
        }
        $regex .= "(\\?.*)?\$";
        $r->headers_out->{'X-Pr0n-Purge'} = $regex;
-
-       $r->log->info($r->headers_out->{'X-Pr0n-Purge'});
 }
                                
 # Find a list of all cache URLs for a given image, given what we have on disk.