diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-15 16:26:03 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-15 16:26:03 +0200 |
| commit | 79f0e696f3f6067a0841a37404fb546dedaa07cb (patch) | |
| tree | a064f2841dc532f81fcf04eb84300e679fda2b27 /check/commands/phash/load.py | |
| parent | e257e83f313a2976347b0a30f58e66b7bcbc1235 (diff) | |
cli suite working
Diffstat (limited to 'check/commands/phash/load.py')
| -rw-r--r-- | check/commands/phash/load.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/check/commands/phash/load.py b/check/commands/phash/load.py new file mode 100644 index 0000000..ce9ceef --- /dev/null +++ b/check/commands/phash/load.py @@ -0,0 +1,23 @@ +""" +Loop over a directory of images + - Compute their phashes + - Optionally upload them to s3? +""" + +import click +import glob + +from app.models.sql_factory import add_phash_by_filename + +@click.command() +@click.option('-i', '--input', 'opt_input_glob', + required=True, + help="File glob to add -- e.g. '../docs/images/*.jpg'") +@click.pass_context +def cli(ctx, opt_input_glob): + """ + Add a directory of images + """ + print('Adding a directory...') + for fn in glob.iglob(opt_input_glob): + add_phash_by_filename(fn) |
