wagtail-webradio
Manage your web radio - e.g. podcasts, programs - in Wagtail.
Warning! This project is still early on in its development lifecycle. It is possible for breaking changes to occur between versions until reaching a stable 1.0. Feedback and pull requests are welcome.
Requirements
This package requires the following:
- Python 3 (3.10, 3.11, 3.12, 3.13)
- Django (4.2 LTS, 5.2 LTS)
- Wagtail (7.0 LTS, 7.1)
Installation
- Install using
pip:pip install wagtail-webradio
- Add
wagtail_webradioto yourINSTALLED_APPSsetting:INSTALLED_APPS = [ # ... 'wagtail_webradio', # ... ]
- Run
python manage.py migrateto create the models
Usage
Configuration
WEBRADIO_PODCAST_SOUND_FILE
Default: True
When set to False, the sound file field of a podcast is disabled and it is
only possible to set the sound by its URL.
WEBRADIO_ALLOWED_AUDIO_MIME_TYPES
Default:
['audio/ogg', 'audio/mpeg', 'audio/flac', 'audio/opus']
A list of audio MIME types which are allowed when uploading a podcast's sound file.
Frontend components
A player with a playlist management is provided to be easily included into your frontend. Under the hood, it uses django-unicorn with a bit of JavaScript to manipulate the audio from the Web browser. It is currently unstyled but you can find an example when using Bootstrap. You should also have a look to the template of this component to know how to extend it.
To make use of it:
- Install the
playerextra of this package:pip install wagtail-webradio[player]
- Integrate
Unicornin your project by following the documentation - Configure
Unicornsettings to look for this package's components:UNICORN = { 'APPS': ['wagtail_webradio'], }
Then, e.g. in base.html, load the player scripts in the <head> of your
document and the component in the <body>:
<html>
<head>
<!-- […] -->
<script src="{% static "wagtail_webradio/player/js/main.js" %}" defer></script>
</head>
<body>
<! -- […] -->
{% unicorn "player" %}
<! -- […] -->
</body>
</html>
In the case of multi-process production environment, you must switch to redis, memcache or database caching to make Unicorn working correctly. For example with memcache listening through unix socket, you can add in settings.py :
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': 'unix:/var/run/memcached/memcached.sock',
}
}
When the player scripts are loaded, you can simply add a song to the playlist
by defining a data-player-add-podcast or data-player-add attribute on an
element, and optionally data-player-autoplay to play the song once added:
<button data-player-add-podcast="10" data-player-autoplay>Add a podcast by id</button>
<button data-player-add="{'title': 'Title', 'subtitle': 'Subtitle', 'url': 'http://example.org/song.ogg', 'thumbnail_url': 'http://example.org/thumb.png'}">
Add a song
</button>
Development
Quick start
To set up a development environment, ensure that Python 3 is installed on your system. Then:
- Clone this repository
- Create a virtual environment and activate it:
$ python3 -m venv venv $ source venv/bin/activate
- Install this package and its requirements:
(venv)$ pip install --editable ".[components]" --group dev
To run the test app interactively, use tox -e interactive, visit
http://127.0.0.1:8020/admin and log in
with admin / changeme.
Contributing
The tests are written with pytest and code coverage is measured with coverage. You can use the following commands while developing:
make test: run the tests and output a quick report of code coveragemake test-wip: only run the tests marked as 'wip'make test-all: run the tests on all supported versions of Django and Wagtail with tox
The Python code is formatted and linted thanks to ruff. You can check the code
with make lint and try to fix the reported issues with make format.
When submitting a pull-request, please ensure that the code is well formatted and covered, and that all the tests pass.
License
This extension is mainly developed by Cliss XXI and licensed under the AGPLv3+. Any contribution is welcome!
Metadata
Release files for wagtail-webradio 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wagtail_webradio-0.7.0.tar.gz | 86.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtail_webradio-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 184.4 kB
Release files / wagtail_webradio-0.7.0.tar.gz
| Download URL | wagtail_webradio-0.7.0.tar.gz |
|---|---|
| Size | 86.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b693a82f2d24cb5bc1cec5b3c0dce466ed527ee7d3b338fe92f42bf894f8ee5d
|
|
BLAKE2b-256 checksum How to use checksums |
ec80f4bf121a625f613ee65d98b7d02eadae99cefb302d51b186dbd359033a73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / wagtail_webradio-0.7.0-py3-none-any.whl
| Download URL | wagtail_webradio-0.7.0-py3-none-any.whl |
|---|---|
| Size | 97.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df10ec2b0f140e9201eef38a70df2543ca0514d1587e0666b33bc79696626f6f
|
|
BLAKE2b-256 checksum How to use checksums |
f2d90271e25f734b3c964595e5133dfc95f3530fe0c0413f75846490fb6b6ee2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|