Scans the filesystem for audio files and writes metadata about them to an API.
- docker
- docker-compose
nice -19 docker-compose up -d --no-build
To test the script logic with worrying about cronjobs.
Set entrypoint: pipenv run python -u import.py
in the docker-compose file (or equivalent)
Run pipenv install
to setup
pipenv run python import.py
Doesn't use a proper testing framework. However, run
docker compose up test --build --exit-code-from test
which will check various calls to the scan_file() function, relying on files in the test_tracks
directory
For local development, these should be stored in a .env file
- MEDIA_DIRECTORY The directory in which to look for audio files to import
- MEDIA_PREFIX Added to the start of each track's local path to form the url for that track
- MEDIA_API URL of an instance of lucos_media_metadata_api
Dockerfile
,Pipfile
,Pipfile.lock
and the.cirleci
directory are used at build timesrc
directory holds the python source codelogic.py
holds the logic for evaluating an audio track on the filesystem and adding an appropriate entry in the metadata API.import.py
is script which iterates through all files in the MEDIA_DIRECTORY and imports them to the API.test.py
does some simple checks on the logic insrc/logic.py
.
startup.sh
ensures the cron daemon is running with the right environment set up and sharing its logs in a way that get surfaced to Dockertest_tracks
a collection of audio tracks used for testing. Not included in the final docker image