Skip to content

Latest commit

 

History

History
95 lines (61 loc) · 2.34 KB

plugins.rst

File metadata and controls

95 lines (61 loc) · 2.34 KB

Plugins

How to use plugins

Plugins must be specified with the plugins setting:

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:

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

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:

../sigal/plugins/copyright.py

Signals

sigal.signals.album_initialized(album)

Called after the ~sigal.gallery.Album is initialized.

param album

the ~sigal.gallery.Album object.

sigal.signals.gallery_initialized(gallery)

Called after the gallery is initialized.

param gallery

the Gallery object.

sigal.signals.media_initialized(media)

Called after the ~sigal.gallery.Media (~sigal.gallery.Image or ~sigal.gallery.Video) is initialized.

param media

the media object.

sigal.signals.gallery_build(gallery)

Called after the gallery is build (after media are resized and html files are written).

param gallery

the Gallery object.

sigal.signals.img_resized(img, settings=settings)

Called after the image is resized. This signal work differently, the modified image object must be returned by the registered funtion.

param img

the PIL image object.

param settings

the settings dict.

List of plugins

Adjust plugin

sigal.plugins.adjust

sigal.plugins.copyright