diff --git a/README.md b/README.md

index 0aba388fb111b8b0887100ff700b74a027311119..3ac16b366ca1c10efa1d569e2b7d62ec5e593bb4 100644

--- a/README.md

+++ b/README.md

@@ -4,8 +4,24 @@ This project is about a small project providing some stats of your photography.

It is mainly a small [SQlite](https://sqlite.org) database that stores the data which is extracted from the exif data of your images using [exiftool](https://exiftool.org/) and provides some predefined statistics about the data.

-### requirements

+## requirements

The famous `exiftool` needs to be installed on your system.

+

+### bare scripts

+Simply clone the repo or manually download the scripts from https://git.sr.ht/~rwa/photo-stats/

+

+To run a script, open a shell and invoke `perl script.pl`, on most systems it should be sufficient to just invoke `script.pl` (after you granted execute-permissions to the script).

+Prerequisites for running the pure scripts

+

+- Perl 5.30 (or newer)

+

+Additionally the following perl modules need to be installed:

+

+- Cwd

+- DBI

+- Perl::DBD::SQLite

+- File::HomeDir

+- File::Spec::Functions

## available stats

- pictures by lens

diff --git a/phosta.pl b/phosta.pl

index d8b47385d0d0bc49c013edfcfa5cf830b927101b..c2194985f5b91f323eae97d75dea0864a0eddd36 100755

--- a/phosta.pl

+++ b/phosta.pl

@@ -7,10 +7,17 @@ use warnings;

use strict;

use feature qw(say);

use Cwd;

+use DBI;

use File::Basename;

use File::Spec::Functions;

use File::HomeDir;

use Getopt::Std;

+

+my $driver = "SQLite";

+my $database = "photo_stats.db";

+my $dsn = "DBI:$driver:dbname=$database";

+my $userid = "";

+my $password = "";

$Getopt::Std::STANDARD_HELP_VERSION = 'true';

@@ -46,13 +53,26 @@ my ($destination_dir) = @_;

say "Scanning $destination_dir for files...";

- my $cmd = "exiftool -r -m -f -p '\$filepath##\$make##\$model##\$lens##\$lensmodel##\$focallength##\$focallengthin35mmformat##\$aperture##\$shutterspeed##\$iso##\$flash##\$datetimeoriginal\"' -d \"%Y-%m-%d %H:%M:%S\" -ext jpg " . $destination_dir;

+ my $cmd = "exiftool -r -m -f -p '\$filepath##\$make##\$model##\$lens##\$lensmodel##\$focallength##\$focallengthin35mmformat##\$aperture##\$shutterspeed##\$iso##\$flash##\$datetimeoriginal' -d \"%Y-%m-%d %H:%M:%S\" -ext jpg " . $destination_dir;

my @lines = qx($cmd);

+ my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 })

+ or die $DBI::errstr;

+ $dbh->do('DELETE FROM photos');

+ my $errorcount = 0;

foreach (@lines)

{

- say "$_";

+ chomp $_;

+ my ( $file, $maker, $model, $lens, $lensmodel, $fl, $fl35, $apert, $ss, $iso, $flash, $date ) = split(/#/, $_);

+ $lens = ($lens ne '-') ? $lens : $lensmodel;

+

+ ($date ne '-' && $model ne '-') or next;

+

+ my $stmt = "INSERT INTO photos (file, maker, model, lens, focallength, focallength35mm, aperture, shutterspeed, iso, flash, datetimeoriginal)

+ VALUES ('$file', '$maker', '$model', '$lens', '$fl', '$fl35', '$apert', '$ss', '$iso', '$flash', '$date')";

+ my $rv = $dbh->do($stmt) or die $DBI::errstr;

}

+ $dbh->disconnect();

}

sub getconfig