### Description Added filters for genre and md5 to the files API, e.g. `/api/v2/files?genre=soul` **This is a new feature**: Yes **I have updated the documentation to reflect these changes**: No There should be a schema and docs that are generated automatically. I don't know where that is. ### Testing Notes **What I did:** - Used docker to deploy locally - Confirmed filters work at http://localhost:8080/api/v2/files?genre=Soul **How you can replicate my testing:** - `make clean dev` - Upload some files! - Visit http://localhost:8080/api/v2/files - You can use the filters <img width="658" alt="Screenshot 2024-12-23 at 01 36 01" src="https://github.com/user-attachments/assets/ba19f7f3-fb3e-495d-8937-d451c70d326c" /> <img width="652" alt="Screenshot 2024-12-23 at 01 35 56" src="https://github.com/user-attachments/assets/c7191131-a963-463a-b52f-9d0952192555" /> _How can the reviewer validate this PR?_ - See above - wrote tests to confirm filters work |
||
---|---|---|
.. | ||
install/systemd | ||
libretime_api | ||
Makefile | ||
README.md | ||
packages.ini | ||
pyproject.toml | ||
requirements.txt | ||
schema.yml | ||
setup.py |
README.md
LibreTime API
This API provides access to LibreTime's database via a Django application.
Deploying
Deploying in a production environment is done in the install
script which installs LibreTime. This is how the API is installed in the Vagrant
development images too. This method does not automatically reflect changes to
this API. After any changes, the libretime-api
systemd service needs
restarting:
sudo systemctl restart libretime-api
Connections to the API are proxied through the Apache web server by default.
Endpoint exploration and documentation is available from
http://example.com/api/v2/schema/swagger-ui/
, where example.com
is the URL
for the LibreTime instance.
Development
For development, you can install all required dependencies and loading the environment using the following command:
make install
source .venv/bin/activate
You should be able to lint or format the code or run api commands:
make format
make lint
libretime-api help
In order to work with the database and message queue, you need to start the docker based development stack present at the project root:
pushd ..
docker-compose up -d
popd
You can now run the api tests:
make test
Inside Vagrant
You can develop the api using a live reloading version within Vagrant:
vagrant up bullseye
vagrant ssh bullseye
cd /vagrant/api
sudo pip3 install -e .
sudo systemctl stop libretime-api
sudo -u libretime LIBRETIME_DEBUG=True libretime-api runserver 0.0.0.0:8081
3rd Party Licences
libretime_api/tests/resources/song.mp3
: Steps - Tears On The Dancefloor (Album
Teaser) by mceyedol. Downloaded from
https://soundcloud.com/mceyedol/steps-tears-on-the-dancefloor-album-teaser
released under a Creative Commons Licence
(cc-by-sa-nc-sa)