diff options
Diffstat (limited to 'check/commands/imagehash/add.py')
| -rw-r--r-- | check/commands/imagehash/add.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/check/commands/imagehash/add.py b/check/commands/imagehash/add.py deleted file mode 100644 index 73f8b69..0000000 --- a/check/commands/imagehash/add.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Add a file to the database -""" - -import click -import os - -from app.models.sql_factory import search_by_phash, add_phash -from app.utils.im_utils import compute_phash_int -from app.utils.file_utils import sha256 - -@click.command() -@click.option('-i', '--input', 'opt_fn', - required=True, - help="File to add (gif/jpg/png)") -@click.option('-u', '--upload', 'opt_upload', is_flag=True, - help='Whether to upload this file to S3') -@click.pass_context -def cli(ctx, opt_fn, opt_upload): - """ - Add a single file - """ - print('Adding a file...') - if not os.path.exists(opt_fn): - print("File does not exist") - return - - hash = sha256(opt_fn) - phash = compute_phash_int(opt_fn) - - dir, fn = os.path.split(opt_fn) - root, ext = os.path.splitext(fn) - - add_phash(sha256=hash, phash=phash, ext=ext) |
