From 79f0e696f3f6067a0841a37404fb546dedaa07cb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 15 Apr 2019 16:26:03 +0200 Subject: cli suite working --- check/commands/imagehash/query.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 check/commands/imagehash/query.py (limited to 'check/commands/imagehash/query.py') diff --git a/check/commands/imagehash/query.py b/check/commands/imagehash/query.py deleted file mode 100644 index f5d3a54..0000000 --- a/check/commands/imagehash/query.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Search the database for an image -""" - -import click -import os - -from app.models.sql_factory import search_by_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 search") -@click.pass_context -def cli(ctx, opt_fn): - """ - Search the database for an image - """ - print('Searching for 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) - - res = search_by_hash(hash) - print("search by hash:", res) - - res =search_by_phash(phash) - print("search by phash:", res) -- cgit v1.2.3-70-g09d2