X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FIndex.pm;h=cb83a9252933dcb9c19dae44de0b13666c835b7b;hp=329aaed3cf02d3f0ce7bd13aa2c855856a144f3d;hb=400a1bbb95bf6837807e2819825cddd00c219cf1;hpb=b1d9d41ab12d664d6fb97d86963a94dbda63e60a diff --git a/perl/Sesse/pr0n/Index.pm b/perl/Sesse/pr0n/Index.pm index 329aaed..cb83a92 100644 --- a/perl/Sesse/pr0n/Index.pm +++ b/perl/Sesse/pr0n/Index.pm @@ -63,8 +63,8 @@ sub handler { $where = ' AND event=' . $dbh->quote($event); } - # Any NEF files => default to processing - my $ref = $dbh->selectrow_hashref("SELECT * FROM images WHERE vhost=? $where AND ( LOWER(filename) LIKE '%.nef' OR LOWER(filename) LIKE '%.cr2' ) LIMIT 1", + # Any NEF files with no non-NEF renders => default to processing + my $ref = $dbh->selectrow_hashref("SELECT * FROM images WHERE vhost=? $where AND ( LOWER(filename) LIKE '%.nef' OR LOWER(filename) LIKE '%.cr2' ) AND render_id IS NULL LIMIT 1", undef, Sesse::pr0n::Common::get_server_name($r)) and $defsettings{'xres'} = $defsettings{'yres'} = undef; @@ -122,9 +122,8 @@ sub handler { } } if (defined($author)) { - my $aq = $dbh->quote($author); - - $where .= " AND takenby=$aq"; + my @authors = split /,/, $author; + $where .= " AND takenby IN (" . join(', ', map { $dbh->quote($_) } @authors) . ")"; } if (defined($num) && $num == -1) { @@ -156,13 +155,13 @@ sub handler { # } # Count the number of selected images. - $ref = $dbh->selectrow_hashref("SELECT COUNT(*) AS num_selected FROM images WHERE vhost=? $where AND selected=\'t\'", undef, Sesse::pr0n::Common::get_server_name($r)); + $ref = $dbh->selectrow_hashref("SELECT COUNT(*) AS num_selected FROM images WHERE vhost=? $where AND selected AND NOT is_render", undef, Sesse::pr0n::Common::get_server_name($r)); my $num_selected = $ref->{'num_selected'}; # Find all images related to this event. my $limit = (defined($start) && defined($num) && !$settings{'fullscreen'}) ? (" LIMIT $num OFFSET " . ($start-1)) : ""; - my $q = $dbh->prepare("SELECT *, (date - INTERVAL '6 hours')::date AS day FROM images WHERE vhost=? $where ORDER BY (date - INTERVAL '6 hours')::date $datesort,takenby,date,filename $limit") + my $q = $dbh->prepare("SELECT *, (date - INTERVAL '6 hours')::date AS day FROM images WHERE vhost=? $where AND NOT is_render ORDER BY (date - INTERVAL '6 hours')::date $datesort,takenby,date,filename $limit") or return dberror($r, "prepare()"); $q->execute(Sesse::pr0n::Common::get_server_name($r)) or return dberror($r, "image enumeration"); @@ -225,6 +224,7 @@ sub handler { COUNT(*) AS num FROM images WHERE vhost=? $where + AND NOT is_render GROUP BY 1,2 ORDER BY 1,2") or die "Couldn't prepare to find equipment: $!"; @@ -340,6 +340,12 @@ sub handler { $imgsz = " width=\"$width\" height=\"$height\""; } + # Add fullscreen link. + my %fssettings = %settings; + $fssettings{'fullscreen'} = 1; + my $fsquery = Sesse::pr0n::Common::get_query_string(\%fssettings, \%defsettings); + $fsquery .= '#' . $img_num; + my $filename = $ref->{'filename'}; my $uri = $filename; if (defined($xres) && defined($yres) && $xres != -1 && $xres != -2) { @@ -358,7 +364,7 @@ sub handler { } else { $io->print(" "); } - $io->print("\"\"$imgsz\n"); + $io->print("\"\"$imgsz\n"); if ($rot == 1) { $io->print(" 90 selectrow_hashref("SELECT count(*) AS num_images FROM images WHERE vhost=? $where", + my $ref = $dbh->selectrow_hashref("SELECT count(*) AS num_images FROM images WHERE vhost=? $where AND NOT is_render", undef, Sesse::pr0n::Common::get_server_name($r)) or return dberror($r, "image enumeration"); my $num_images = $ref->{'num_images'};