Crate festival_api[−][src]
Expand description
Festival to WAV API
A simple REST api which takes a request body of the form:
{
"word": "university",
"lang": "en",
"speed": 0.7,
"fmt": "wav"
}and returns a file which may be streamed or played for a user.
Detailed documentation on how to use the API can be found in openapi.oas.yml.
Deployment
Docker
git clone https://github.com/Collabs-uni/festival-web-api
nano ./config/general.toml #Update any general configuration options you wish to include.
nano ./config/langs.toml #Update any special languages you wish to include (ensure to modify backend.Dockerfile to install them).
docker-compose up #This takes a long timeDevelopment
Fedora
To develop this api, you must have Rust installed.
This api also depends on Ffmpeg, and Flite.
Dependencies
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo dnf groupinstall @development-tools @development-libraries
sudo dnf install festival flite ffmpeg libpq libpq-devel
cargo install rustfmt #for automatic code formatting
cargo install clippy #collection of useful lints
cargo install cargo-tarpaulin #test coverageDevelopment
cargo test -- --test-threads 1
cargo runLicense
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Code Guidelines
Please write tests if we have good test coverage we can avoid any bugs down the line.
Outside of this we use standard Rust formatting for code. This will be enforced through use of clippy and rustfmt.
Commit Guidelines
In all commits, please try to follow the convention for commits.
Ideally aim to push every commit you make, rather than accumulating a large number of commits before pushing, this helps to keep everyone on the same codebase when collaborating.
The exception for this is that you should not commit non-compiling code to the main branch. Open a new branch and commit to that instead.
Use of Pull Requests
Outside of exceptional cases, please always push commits to a new branch and then generate a pull request with your new feature. Automated actions will attempt to validate that your code does not break anything existing, but this doesn’t guarantee your code works. Please write tests!
Modules
Various objects, including database objects, for the api.
Functions
Expects a phrase package, attempts to convert it to a sound file to be returned to the user. Requires an authenticate user account to access. This endpoint also features strict rate limiting as generating .wav files is very resource intensive.
The base url of the program. This is just a catch-all for those who stumble across the api without knowing what it does.
