manage podcats, webradio programs and more in a wagtail website
Project description
wagtail-webradio
Manage your web radio - e.g. podcats, 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:
- Wagtail (2.15 LTS)
- Django (3.1, 3.2)
- Python 3 (3.7, 3.8, 3.9)
Installation
- Install using
pip
:pip install wagtail-webradio
- Add
wagtail_webradio
to yourINSTALLED_APPS
setting:INSTALLED_APPS = [ # ... 'wagtail_webradio', # ... ]
- Run
python manage.py migrate
to create the models
Usage
Frontend components
A player is provided and can be included into your frontend. It uses django-unicorn with a bit of JavaScript to manipulate the audio in the client web browser.
To make use of it:
- Install the
player
extra of this package:pip install wagtail-webradio[player]
- Integrate
Unicorn
in your project by following the documentation - Configure
Unicorn
settings 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>
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 in develop mode with extra requirements:
pip install -e .[test]
If you plan to upload the package on PyPi, you will also need to run:
pip install --upgrade build twine
Contributing
The Python code is formatted and linted thanks to flake8, isort and black. To ease the use of this tools, the following commands are available:
make lint
: check the Python code syntax and imports ordermake format
: fix the Python code syntax and imports order
The tests are written with pytest and code coverage is measured with coverage. You can use the following commands for that:
make test
: run the tests and output a quick report of code coveragemake coverage
: run the tests and produce an HTML report of code coverage
When submitting a pull-request, please ensure that the code is well formatted and covered, and that all the other tests pass.
License
This extension is mainly developed by Cliss XXI and licensed under the AGPLv3+. Any contribution is welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wagtail_webradio-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9bd4bca3ef815bf32da0b935c28be8a9e6672419bde95a89ea17b21047d205b |
|
MD5 | 49754ae0f59f22646549add5cbe5eacc |
|
BLAKE2b-256 | 3f4ea56ff750eef7c693020e77c143d10c226edc3bfd9ddaf68fe538bada42e1 |