blob: ce9ceefebc7e8567df315d1b19735e9a06b9935c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
|