Files
sigal/docs/plugins.rst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

153 lines
3.2 KiB
ReStructuredText
Raw Normal View History

=========
Plugins
=========
2019-08-26 01:14:15 +02:00
.. contents::
2014-05-30 23:32:28 +02:00
How to use plugins
------------------
2014-05-30 23:32:28 +02:00
Plugins must be specified with the ``plugins`` setting:
.. code-block:: python
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright']
You can either specify the name of the module which contains the plugin, or
import the plugin before adding it to the list:
2014-05-30 23:32:28 +02:00
.. code-block:: python
from sigal.plugins import copyright
plugins = ['sigal.plugins.adjust', copyright]
.. note:: Using an import like this will break the multiprocessing feature,
because the settings dict must be serializable. So in most cases you should
prefer the first option.
The ``plugin_paths`` setting can be used to specify paths to search for plugins
(if they are not in the python path).
Write a new plugin
------------------
2014-05-30 23:32:28 +02:00
Plugins are based on signals with the blinker_ library. A plugin must
subscribe to a signal (the list is given below). New signals can be added if
need. See an example with the copyright plugin:
.. _blinker: http://pythonhosted.org/blinker/
2023-01-02 17:24:08 +01:00
.. literalinclude:: ../src/sigal/plugins/copyright.py
:language: python
2014-05-30 23:32:28 +02:00
Signals
-------
.. function:: sigal.signals.album_initialized(album)
:noindex:
Called after the :class:`~sigal.gallery.Album` is initialized.
:param album: the :class:`~sigal.gallery.Album` object.
.. data:: sigal.signals.gallery_initialized(gallery)
:noindex:
Called after the gallery is initialized.
:param gallery: the :class:`Gallery` object.
.. data:: sigal.signals.media_initialized(media)
:noindex:
Called after the :class:`~sigal.gallery.Media`
(:class:`~sigal.gallery.Image` or :class:`~sigal.gallery.Video`) is
initialized.
:param media: the media object.
.. data:: sigal.signals.gallery_build(gallery)
:noindex:
Called after the gallery is build (after media are resized and html files
are written).
:param gallery: the :class:`Gallery` object.
.. data:: sigal.signals.img_resized(img, settings=settings)
:noindex:
Called after the image is resized. This signal work differently, the
2017-10-23 08:18:08 +01:00
modified image object must be returned by the registered function.
2014-05-30 23:32:28 +02:00
:param img: the PIL image object.
:param settings: the settings dict.
List of plugins
---------------
Adjust plugin
2014-05-30 23:32:28 +02:00
=============
.. automodule:: sigal.plugins.adjust
Compress assets plugin
2018-02-16 22:57:16 +01:00
======================
.. automodule:: sigal.plugins.compress_assets
Copyright plugin
2014-05-30 23:32:28 +02:00
================
.. automodule:: sigal.plugins.copyright
2020-04-14 17:52:02 +08:00
Encrypt plugin
==============
.. automodule:: sigal.plugins.encrypt
Extended caching plugin
2017-02-05 23:28:12 +01:00
=======================
.. automodule:: sigal.plugins.extended_caching
2017-02-05 23:28:12 +01:00
Feeds plugin
============
.. automodule:: sigal.plugins.feeds
2014-12-06 23:08:46 +01:00
Media page plugin
=================
.. automodule:: sigal.plugins.media_page
Nomedia plugin
2017-02-05 23:28:12 +01:00
==============
.. automodule:: sigal.plugins.nomedia
2021-06-28 19:14:57 -05:00
Non-media Files plugin
======================
.. automodule:: sigal.plugins.nonmedia_files
Upload to S3 plugin
===================
.. automodule:: sigal.plugins.upload_s3
2015-03-02 20:55:37 +05:30
Watermark plugin
2017-02-05 23:28:12 +01:00
================
2015-03-02 20:55:37 +05:30
.. automodule:: sigal.plugins.watermark
2019-08-26 01:14:15 +02:00
ZIP Gallery plugin
==================
.. automodule:: sigal.plugins.zip_gallery
Titleregexp plugin
==================
.. automodule:: sigal.plugins.titleregexp