# Command line interface

## Overview

The Blurit command line interface, this CLI lets you interact with Blurit On-Premise to perform various tasks related to media anonymization.

## CLI

The main Blurit CLI command.

```bash
blurit [OPTIONS] COMMAND [ARGS]...
```

### License

Manage Blurit licenses.

#### **info**

Displays all Blurit license information.

options:

* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json]   Output format in JSON

```shell
blurit license info
```

Response:

```
+------------+--------------------------+
| Property   | Value                    |
+============+==========================+
| Start Date | 2023-07-31T22:00:00.000Z |
+------------+--------------------------+
| End Date   | 2023-12-31T21:59:59.000Z |
+------------+--------------------------+
| License    | LICENSE                  |
+------------+--------------------------+
```

#### **add**

Upload or update a Blurit On-Premise license.

options:

* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json]   Output format in JSON

```shell
blurit license add LICENSE
```

Response:

```
+------------+--------------------------+
| Property   | Value                    |
+============+==========================+
| Start Date | 2023-06-27T22:00:00.000Z |
+------------+--------------------------+
| End Date   | 2023-09-30T21:59:59.000Z |
+------------+--------------------------+
| License    | LICENSE                  |
+------------+--------------------------+
```

### Tasks

Manage Blurit tasks.

#### **create**

Create a new Blurit task. Options vary depending on the input type (file, directory, S3 or s3-directory). File processing only needs input argument but output can be specified to store the exit media to a precise location.

options:

* \--input-file \[file|directory|s3|s3-directory] REQUIRED
* \--no-face-blur Disable face blur.&#x20;
* \--no-plate-blur Disable plate blur.&#x20;
* \--json-coord Use JSON coordinates.&#x20;
* \--auto-delete Auto deletion of input media&#x20;
* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json] Output format in JSON

```shell
blurit task create [OPTIONS] INPUT OUTPUT
```

Example: Create a task by specifying input and output directories:

```bash
blurit task create --input-type directory input output
```

Response:

```
job id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

#### **status**

Get the status of a specific task using its ID.

options:

* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json]   Output format in JSON

return:

* Succeeded
* Started
* Sent
* Failed
* Couldn't contact the Blurit server

```shell
blurit task status TASK_ID
```

Example:

```bash
blurit tasks status 31bc8405-4a56-4cb2-a67e-689797ad9a1a
```

Response:

```bash
Succeeded
```

#### **list**

List history call tasks.

options:

* \--page TEXT Specify the page number&#x20;
* \--count TEXT Specify the number of results per page&#x20;
* \--starting-date TEXT Specify the starting date&#x20;
* \--ending-date TEXT Specify the ending date&#x20;
* \--filetype \[picture|video|directory] Specify the file type
* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json]   Output format in JSON

```bash
blurit list
```

Response:

```
+--------------------------+-------------------+-------------+--------------------------------------+---------------+-----------------------+---------------+
| Created At               | Processing Time   | File Type   | Job ID                               | File Name     | Output Media URL      | Task Status   |
+==========================+===================+=============+======================================+===============+=======================+===============+
| 2023-08-24T09:18:42.625Z | 05:42:50.70       | directory   | 31bc8405-4a56-4cb2-a67e-689797ad9a1a | 629d57_part_1 | 629d57_part_2_process | Succeeded     |
+--------------------------+-------------------+-------------+--------------------------------------+---------------+-----------------------+---------------+

```

### Configure

Configure the Blurit application, need to be done at least once before first deployment ('blurit start').

```
blurit configure
```

### Start

Start the Blurit server, CLI must be on the host machine.

```
blurit start
```

### Restart

Restart the Blurit server, CLI must be on the host machine.

```
blurit restart
```

### Stop

Stop the Blurit server, CLI must be on the host machine.

```
blurit stop
```

### Stats

Display total and period (month, day) statistics.

options:

* \--date-start TEXT Starting date with format: %Y-%m-%d&#x20;
* \--date-end TEXT Ending date with format: %Y-%m-%d&#x20;
* \--granularity \[day|month] Display statistics by month or days&#x20;
* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json] Output format in JSON&#x20;
* \--help Show this message and exit.

```
blurit stats
```

**Response:**

```
+------------------------------+-----------+
| Metric                       | Value     |
+==============================+===========+
| Total Videos API Calls       | 73        |
+------------------------------+-----------+
| Total Pictures API Calls     | 443       |
+------------------------------+-----------+
| Total Videos Consumption     | 3.33 GB   |
+------------------------------+-----------+
| Total Pictures Consumption   | 806.07 MB |
+------------------------------+-----------+
| Monthly Videos API Calls     | 4         |
+------------------------------+-----------+
| Monthly Pictures API Calls   | 8         |
+------------------------------+-----------+
| Monthly Videos Consumption   | 22.12 MB  |
+------------------------------+-----------+
| Monthly Pictures Consumption | 9.42 MB   |
+------------------------------+-----------+
```

### Doc

Display link to documentation.

options:

* -h, --host TEXT Specify the host&#x20;
* -p, --port INTEGER Specify the port&#x20;
* -o \[json]   Output format in JSON

```
blurit doc
```

response:

```
API Documentation:
Operation: https://doc-op.blurit.io
Local: http://127.0.0.1:8084/api/docs
```

### Uninstall

Uninstall the Blurit server, CLI must be on the host machine.

```
blurit uninstall
```

#### **Output Format**&#x20;

The Blurit CLI supports two output formats: text (default) and JSON. You can specify the output format using the -o or --output-format option. For example, to get JSON output, use -o json.

Example:

```
blurit tasks status 31bc8405-4a56-4cb2-a67e-689797ad9a1a -o json
```

Response:

```
{'task_id': '31bc8405-4a56-4cb2-a67e-689797ad9a1a', 'status': 'Succeeded', 'result': {'input_directory': {'protocol': 'file', 'path': 'input/629d57_part_2', 'auto_delete': False}, 'output_directory': {'protocol': 'file', 'path': 'output/629d57_part_2_process'}, 'size': {'VIDEO': 4979394177}, 'nb_files': {'VIDEO': 252}}}
```

#### **Support and Contribution**&#x20;

If you have any questions, issues, or would like to make a return of the Blurit CLI, please contact us at <support@blurit.io>. We hope this guide helps you effectively use the Blurit CLI to manage your media anonymization tasks.
