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

index acb0b3613b4c835669a057dde9f8b43620d4aece..7563045afee5d679a15c295a4674adc99803a08f 100644

--- a/README.md

+++ b/README.md

@@ -28,9 +28,13 @@ - Perl::DBI

- Text::SimpleTable::AutoWidth

## usage

+### populate the database

Before getting in touch with the stats, you need to populate the database with the data of your images. Run `phosta[.pl] -p <your_image_folder>` to add the data of the images in the folder and every subfolder to the database.

-To query the stats, run `phosta[.pl] -q -s <fields> -g <grouping>`.

+The database will be created in the currend working dir.

+

+### query the database

+To query the stats, simply run `phosta[.pl] -s <fields> -g <grouping>` after you've initially filled the database.

For information about parameters and usage call `phosta[.pl] --help`.

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

index ad6f0bba3e2c288eb118b5461224a6d3c175f658..d34711af6f9b965e6b926628dd7c150bcb88f3a2 100755

--- a/phosta.pl

+++ b/phosta.pl

@@ -16,11 +16,8 @@ use DBI;

use Getopt::Std;

my $driver = "SQLite";

-my $database = "photo_stats.db";

+my $database = getcwd . "/photo_stats.db";

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

-my $userid = "";

-my $password = "";

-

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

my $VERSION = '0.4';

@@ -37,10 +34,10 @@ getopts('cqp:g:s:') or die "Invalid parameters provided! See 'phosta.pl --help' for more details.";

if ( $opt_p ne '' ) {

populate_db($opt_p, $opt_c);

+ exit 0;

}

-if ( $opt_q ) {

- query_db($opt_s, $opt_g)

-}

+

+query_db($opt_s, $opt_g);

exit 0;

@@ -53,7 +50,7 @@

my $cmd = "exiftool -fast2 -r -m -f -p '\$filepath##\$make##\$model##\$lens##\$lensmodel##\$focallength##\$focallengthin35mmformat##\$aperture##\$exposuretime##\$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;

+ my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1 }) or die $DBI::errstr;

if ( $clean ) { $dbh->do('DELETE FROM photos'); }

my $errorcount = 0;

my $emptycount = 0;

@@ -135,7 +132,7 @@ sub query_db

{

my ($selected, $grouping) = @_;

- my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die $DBI::errstr;

+ my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1 }) or die $DBI::errstr;

my $total_count = $dbh->selectrow_array("SELECT count(file) from photos");

say "Querying local database with $total_count entries...";

@@ -168,15 +165,16 @@ sub main::HELP_MESSAGE

{

say '';

say 'Extract the EXIF data of images (currently jpg only) and feed them to a database.';

+ say 'Afterwards query some stats from the selected data.';

say '';

say 'usage: phosta(.pl) [options]';

say '';

say 'options:';

say ' -p <folder> : populate database from the files in the specified folder';

say ' -c : clear the database before populating with data from the folder';

- say ' -g : group by time range, defaults to total (which means no grouping by time range)';

+ say ' -g : (query mode) group by time range, defaults to total (which means no grouping by time range)';

say ' allowed values: year, month, week';

- say ' -s : specify the information you want to select, defaults to none (just show number of images)';

+ say ' -s : (query mode) specify the information you want to select, defaults to none (just show number of images)';

say ' allowed values: maker, model, lens, aperture, exposuretime, iso, focallength, focallength35mm';

say ' multiple fields should be listed comma-separated';

say ' --help : show this help';