teythoon/rss2maildir — pull request #2 by untitaker (2012-07-22 18:19:54+00:00)
Title: Item filter support.

This commit allows you to use so-called item filters, which enable you
to alter any feed items with your own scripts.

You specify a python module with the `item_filters` setting:

[general]
item_filters = ~/stuff/item_filters.py

In the `item_filters.py` you specify the function `get_filters`, which
should return a list of functions. These functions get called in the
order they are specified in the list, with a feed item (instance of
`Item`) as their only argument.

The following code in `item_filters.py` would replace the title and the
content of absolutely every feed item with `New title!` and `New
content!`:

def test_filter2(item):
item.title = 'New title!'
return item

def test_filter1(item):
item.content = 'New content!'
return item

def get_filters():
return [
test_filter1,
test_filter2
]