summaryrefslogtreecommitdiff
path: root/check/commands
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-04-14 17:23:05 +0200
committerJules Laplace <julescarbon@gmail.com>2019-04-14 17:23:05 +0200
commit0a4b3ea4611fcbe66b148041f82e77a0f138e688 (patch)
tree34ccc5ca610cd37ef9ba464287357ac6135cce5b /check/commands
parentfc25a56c128bd05019a3cdc45271d7172a22c7c7 (diff)
scaffold commands
Diffstat (limited to 'check/commands')
-rw-r--r--check/commands/cli_flask.py17
-rw-r--r--check/commands/cli_imagehash.py35
-rw-r--r--check/commands/imagehash/add.py1
-rw-r--r--check/commands/imagehash/load.py3
-rw-r--r--check/commands/imagehash/query.py1
-rw-r--r--check/commands/imagehash/test.py1
6 files changed, 58 insertions, 0 deletions
diff --git a/check/commands/cli_flask.py b/check/commands/cli_flask.py
new file mode 100644
index 0000000..f2f4738
--- /dev/null
+++ b/check/commands/cli_flask.py
@@ -0,0 +1,17 @@
+# --------------------------------------------------------
+# wrapper for flask CLI API
+# NB: python cli_flask.py run
+# --------------------------------------------------------
+
+import click
+
+from flask.cli import FlaskGroup
+from app.server.create import create_app
+
+cli = FlaskGroup(create_app=create_app)
+
+# --------------------------------------------------------
+# Entrypoint
+# --------------------------------------------------------
+if __name__ == '__main__':
+ cli()
diff --git a/check/commands/cli_imagehash.py b/check/commands/cli_imagehash.py
new file mode 100644
index 0000000..c51c84c
--- /dev/null
+++ b/check/commands/cli_imagehash.py
@@ -0,0 +1,35 @@
+# --------------------------------------------------------
+# add/edit commands in commands/datasets directory
+# --------------------------------------------------------
+
+import click
+
+from app.settings import app_cfg as cfg
+from app.utils import logger_utils
+from app.models.click_factory import ClickSimple
+
+# click cli factory
+cc = ClickSimple.create(cfg.DIR_COMMANDS_IMAGEHASH)
+
+# --------------------------------------------------------
+# CLI
+# --------------------------------------------------------
+@click.group(cls=cc, chain=False)
+@click.option('-v', '--verbose', 'verbosity', count=True, default=4,
+ show_default=True,
+ help='Verbosity: -v DEBUG, -vv INFO, -vvv WARN, -vvvv ERROR, -vvvvv CRITICAL')
+@click.pass_context
+def cli(ctx, **kwargs):
+ """\033[1m\033[94mMegaPixels: Dataset Image Scripts\033[0m
+ """
+ ctx.opts = {}
+ # init logger
+ logger_utils.Logger.create(verbosity=kwargs['verbosity'])
+
+
+# --------------------------------------------------------
+# Entrypoint
+# --------------------------------------------------------
+if __name__ == '__main__':
+ cli()
+
diff --git a/check/commands/imagehash/add.py b/check/commands/imagehash/add.py
new file mode 100644
index 0000000..7c5dc31
--- /dev/null
+++ b/check/commands/imagehash/add.py
@@ -0,0 +1 @@
+# add a file to the database \ No newline at end of file
diff --git a/check/commands/imagehash/load.py b/check/commands/imagehash/load.py
new file mode 100644
index 0000000..bdcb19c
--- /dev/null
+++ b/check/commands/imagehash/load.py
@@ -0,0 +1,3 @@
+# loop over a directory of images
+# - compute their phashes
+# - optionally upload them to s3?
diff --git a/check/commands/imagehash/query.py b/check/commands/imagehash/query.py
new file mode 100644
index 0000000..eb15960
--- /dev/null
+++ b/check/commands/imagehash/query.py
@@ -0,0 +1 @@
+# search the database for a file \ No newline at end of file
diff --git a/check/commands/imagehash/test.py b/check/commands/imagehash/test.py
new file mode 100644
index 0000000..05d2ee4
--- /dev/null
+++ b/check/commands/imagehash/test.py
@@ -0,0 +1 @@
+# query the database with a test set \ No newline at end of file