X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=0b2fa2488f1df4e7e3e463e015d6db0a13a4663e;hb=97587692088c0aebc302164e335817f5dfedc49f;hp=1472b7991915c286ae34e894e4c58e43c6005ae1;hpb=f5c2a91d469df8a49364be887bf0a7a0e4b50c2f;p=pr0n
diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm
index 1472b79..0b2fa24 100644
--- a/perl/Sesse/pr0n/Common.pm
+++ b/perl/Sesse/pr0n/Common.pm
@@ -31,7 +31,7 @@ BEGIN {
require Sesse::pr0n::Config_local;
};
- $VERSION = "v2.05";
+ $VERSION = "v2.10";
@ISA = qw(Exporter);
@EXPORT = qw(&error &dberror);
%EXPORT_TAGS = qw();
@@ -117,10 +117,10 @@ sub scale_aspect {
return ($width, $height);
}
-sub print_link {
- my ($r, $title, $baseurl, $param, $defparam) = @_;
- my $str = "$title";
+ return $str;
+}
+
+sub print_link {
+ my ($r, $title, $baseurl, $param, $defparam) = @_;
+ my $str = "$title";
$r->print($str);
}
@@ -141,7 +145,7 @@ sub get_dbh {
# Try to reconnect
Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
- $Sesse::pr0n::Config::db_user, $Sesse::pr0n::Config::db_password)) {
+ $Sesse::pr0n::Config::db_username, $Sesse::pr0n::Config::db_password)) {
$dbh = undef;
die "Couldn't connect to PostgreSQL database";
}
@@ -288,7 +292,6 @@ sub ensure_cached {
# NEF files aren't autodetected
$fname = "NEF:$fname" if ($filename =~ /\.nef$/i);
- $r->log->warn("Generating $fname for $filename");
my $err = $magick->Read($fname);
if ($err) {
@@ -394,7 +397,12 @@ sub make_infobox {
push @lines, "$1-$2-$3 $4:$5";
}
- push @lines, $info->{'Model'} if (defined($info->{'Model'}));
+ if (defined($info->{'Model'})) {
+ my $model = $info->{'Model'};
+ $model =~ s/^\s+//;
+ $model =~ s/\s+$//;
+ push @lines, $model;
+ }
# classic fields
if (defined($info->{'FocalLength'}) && $info->{'FocalLength'} =~ /^(\d+)(?:\.\d+)?(?:mm)?$/) {
@@ -440,9 +448,11 @@ sub make_infobox {
if (defined($info->{'Flash'})) {
if ($info->{'Flash'} =~ /did not fire/i ||
$info->{'Flash'} =~ /no flash/i ||
- $info->{'Flash'} =~ /not fired/i) {
+ $info->{'Flash'} =~ /not fired/i ||
+ $info->{'Flash'} =~ /Off/) {
push @lines, "No flash";
- } elsif ($info->{'Flash'} =~ /fired/i) {
+ } elsif ($info->{'Flash'} =~ /fired/i ||
+ $info->{'Flash'} =~ /On/) {
push @lines, "Flash";
} else {
push @lines, $info->{'Flash'};