X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2Fupdate-image-cache.pl;h=0ed6931bfe63ca4a2fcf648fa3e03202d765360b;hp=213a7a0cb1ee6b14386161357762e699ad6b6318;hb=HEAD;hpb=45ee05e19e1039e74e2b7ca4955b007d2cd3ed69 diff --git a/perl/update-image-cache.pl b/perl/update-image-cache.pl index 213a7a0..f50d3a0 100755 --- a/perl/update-image-cache.pl +++ b/perl/update-image-cache.pl @@ -51,6 +51,8 @@ sub warn { sub error { print STDERR $_[1], "\n"; } +sub logger { +} package main; use Sesse::pr0n::Common; @@ -101,7 +103,6 @@ while (my $ref = $q->fetchrow_hashref) { if (!$regen_mipmaps) { @files = grep { !/mipmap/ } @files; } - my @boxres = (); my @noboxres = (); my $any_old = 0; for my $c (@files) { @@ -111,17 +112,12 @@ while (my $ref = $q->fetchrow_hashref) { } if ($c =~ /$id-(\d+)-(\d+)-nobox\.jpg/ || $c =~ /$id-(-1)-(-1)-nobox\.jpg/) { push @noboxres, [$1, $2]; - } elsif ($c =~ /$id-(\d+)-(\d+)-box\.png/ || $c =~ /$id-(-1)-(-1)-box\.png/) { - push @boxres, [$1, $2]; } } next unless $any_old; - unlink (@files); + unlink (@files) or die "Could not delete: $!"; if (scalar @noboxres > 0) { - Sesse::pr0n::Common::ensure_cached($r, $ref->{'filename'}, $id, $ref->{'width'}, $ref->{'height'}, 1, sort_res(@noboxres)); - } - if (scalar @boxres > 0) { - Sesse::pr0n::Common::ensure_infobox_cached($r, $ref->{'filename'}, $id, $ref->{'width'}, $ref->{'height'}, 1, sort_res(@boxres)); + Sesse::pr0n::Common::ensure_cached($r, $ref->{'filename'}, $id, $ref->{'width'}, $ref->{'height'}, sort_res(@noboxres)); } my @newfiles = glob("../cache/$dir/$id-*.jpg");