minor update

This commit is contained in:
Daniel Knüttel 2019-08-14 17:57:34 +02:00
parent 6679ef7cfd
commit 62d7cb1c45
2 changed files with 54 additions and 1 deletions

View File

@ -6,7 +6,57 @@ autoimport
What is autoimport? What is autoimport?
=================== ===================
autoimport is a python3 module and program for importing photos into ``autoimport`` is a python3 module and program for importing photos into
a libraries using metadata, namely the name; the date and time of a libraries using metadata, namely the name; the date and time of
the photo, the digitization and the original; the Model and Make the photo, the digitization and the original; the Model and Make
and the Software used to create the photo. and the Software used to create the photo.
Usage
=====
``autoimport`` is used in basically two steps: selecting files to copy/move
and then actually copying and moving the files. By default the selection step
is implicit, but it can be run separately using ``autoimport select``.
``autoimport --help`` gives a list of all available commands and options.
Extended Usage
==============
Persistent Database
-------------------
It can be quite useful to run the selection and actual operation separately.
For instance, when the actual data is unknow and/or homogenous. To avoid
long search times, the intermediate data should then be stored.
This is done using the ``--storage`` option that specifies a path where
a sqlite3 database containing the data is stored.
A typical use case is a collection of RAW and JPEG data, which might be quite big::
autoimport select images/ --storage=autoimport.db -p jpg --walk
autoimport select images/ --storage=autoimport.db -p dng --walk
Then the files can be copied using::
autoimport copy images/ new_images --storage=autoimport.db
rm autoimport.db
without having to re-search all files.
The persistent can also be used to explicitly exclude some files using extra scipts,
by accessing the database directly. This requires some knowledge in sqlite3 (and maybe
python3)::
autoimport select images/ --storage=autoimport.db -p jpg --walk
sqlite3
> .open autoimport.db
> DELETE FROM FILES WHERE Model='Nexus 5X';
> ^D
autoimport copy images/ new_images/ --storage=autoimport.db
This example shows how to remove all images made with the Nexus 5X (a cellphone) from the
files that are copied.

View File

@ -85,4 +85,7 @@ def get_persistent_db(path):
return db return db
if(not os.path.exists(os.path.dirname(path))): if(not os.path.exists(os.path.dirname(path))):
raise IOError("path '{}' does not exist".format(os.path.dirname(path))) raise IOError("path '{}' does not exist".format(os.path.dirname(path)))
db = PersistentDatabase(path)
initialize_database(db)
return db
return PersistentDatabase(path) return PersistentDatabase(path)