App-Fotagger

 view release on metacpan or  search on metacpan

lib/App/Fotagger/Deleter.pm  view on Meta::CPAN

        my $image = App::Fotagger::Image->new({file=>$file});
        $image->read;
        if ($image->tags ~~ /TO_DELETE/) {
            if ($self->ask) {
                print "delete $file? (y/N) ";
                my $answer = <STDIN>;
                chomp $answer;
                next unless $answer ~~ /y/i;
            }
            unless ($self->dry_run) {
                unlink($file) || say "Couldn't unlink $file";
                $count++;
            }
            say "deleted $file" if $self->verbose;
        }
    }
    say "deleted $count file".($count>1?'s':'');
}

q{ listening to:
    Soap & Skin - Lovetune For Vacuum
};

lib/App/Fotagger/Export.pm  view on Meta::CPAN

        
        
        #if ($keep_tags) { 
        #    my @tags = $image->tags; ..
        #    }
        
        if ($keep_star) {
            my $cmp = eval $image->stars.$keep_star;
            next unless ($cmp);
        }
        say $image->file, $image->stars;
        
        # export it!
        $count++;
        my $img = Imager->new();
        $img->read(file=>$image->file) or die $img->errstr();
        my $scaled = $img->scale(xpixels=>$resize_x, ypixels=>$resize_y);
        $scaled->write(file=>catfile($self->target,sprintf("%08d.jpg",$count)));


    }

lib/App/Fotagger/Stats.pm  view on Meta::CPAN

    return {
        tags=>\%tags,
        stars=>\%stars,
        count=>scalar @{$self->images},
    };
}

sub dump {
    my ($self, $stats) = @_;
    local $Data::Dumper::Sortkeys=1;
    say Dumper $stats;
}

sub report {
    my ($self, $stats) = @_;

    say "Processed ".$stats->{count}." images";
    
    my $format="  %".length($stats->{count})."d  ";
    for my $s (0..5) {
        next unless $stats->{stars}{$s};
        my $line = ("*" x $s ) .  (" " x (5-$s)). sprintf($format,scalar @{$stats->{stars}{$s}}) ;
        say $line;
    }

    foreach my $tag (sort { scalar @{$stats->{tags}{$b}} <=> scalar @{$stats->{tags}{$a}} } keys %{$stats->{tags}}) {
        say sprintf($format,scalar @{$stats->{tags}{$tag}}).$tag;
    }
}

q{ listening to:
    Dan le Sac vs Scroobius Pip - Angels
};



( run in 1.836 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )