79 lines
2.0 KiB
Markdown
79 lines
2.0 KiB
Markdown
|
# Mazash
|
||
|
![Swagger UI API documentation](swagger_ui.png)
|
||
|
Minimal application IPFS & Dejavu
|
||
|
|
||
|
The following features are included in the application:
|
||
|
|
||
|
* Recognize song by CID ipfs and extension
|
||
|
* Fingerpint CID IPFS, extension, song name
|
||
|
* API documentation using the OpenAPI 3 specification and Swagger UI
|
||
|
|
||
|
|
||
|
## Setup
|
||
|
|
||
|
To set up the application, you need Python 3. After cloning the repository change to the project directory and install the dependencies via:
|
||
|
|
||
|
```
|
||
|
python3 -m pip install requirements.txt
|
||
|
```
|
||
|
|
||
|
## Development
|
||
|
|
||
|
To start the app in development mode, execute
|
||
|
|
||
|
```
|
||
|
./run_app_dev.sh
|
||
|
```
|
||
|
|
||
|
The application will then be available at `localhost:5000`. You can test the functionality manually using `curl`, e.g. via
|
||
|
|
||
|
```
|
||
|
curl localhost:5000/api/v1/path_for_blueprint_x/test
|
||
|
```
|
||
|
|
||
|
or through the automated tests, by running
|
||
|
|
||
|
```
|
||
|
pytest
|
||
|
```
|
||
|
|
||
|
The commands should output
|
||
|
```
|
||
|
{
|
||
|
"msg": "I'm the test endpoint from blueprint_x."
|
||
|
}
|
||
|
```
|
||
|
|
||
|
and
|
||
|
|
||
|
```
|
||
|
test/test_endpoints.py ....
|
||
|
|
||
|
============= 4 passed in 0.14s ==============
|
||
|
```
|
||
|
|
||
|
respectively.
|
||
|
|
||
|
To view the API documentation through the Swagger user interface, navivate your browser to `localhost:5000/api/docs`.
|
||
|
|
||
|
## Production
|
||
|
|
||
|
To run the app in production, execute
|
||
|
```
|
||
|
./run_app_prod.sh
|
||
|
```
|
||
|
|
||
|
Now the application is served on `localhost:8600`. To run the automated tests for the production host, use
|
||
|
|
||
|
```
|
||
|
pytest --host http://localhost:8600
|
||
|
```
|
||
|
|
||
|
## mp3 for test
|
||
|
|
||
|
https://github.com/worldveil/dejavu/blob/master/mp3/Brad-Sucks--Total-Breakdown.mp3 -> QmU3XRYZiebdDMcUwKrvecxyDgtgVY6zaNYrzQBeCkFb2r
|
||
|
|
||
|
curl -X POST "http://localhost:8600/api/v1/mazash/recognize" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"cid\":\"QmU3XRYZiebdDMcUwKrvecxyDgtgVY6zaNYrzQBeCkFb2r\",\"extension\":\".mp3\",\"song\":\"Brad-Sucks--Total-Breakdown\"}"
|
||
|
|
||
|
|
||
|
curl -X POST "http://localhost:8600/api/v1/mazash/recognize" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"cid\":\"QmU3XRYZiebdDMcUwKrvecxyDgtgVY6zaNYrzQBeCkFb2r\",\"extension\":\".mp3\"}"
|