For a long time I’ve been an user of google reader. It’s a fine reader, but it lacks any ability to filter the news in a custom way.

For example I subscribed to a feed containing the special offers for games on Steam. But what if I don’t want to see them all ? Maybe I’m just a cheap guy, and I’m not interested in titles over $10.00 ^_^, or discounts that aren’t worth at least the 75% of the original price. There are a number of online sites offering filtering tools, like FeedRinse, but I found none that could satisfy all my needs.

I needed something that would allow me to read the feeds from almost anywhere (possibly on my phone), but would not tie me to yet another web site to keep open on my browser.

The solution is simple and not even new: put them in my email. In fact I wrote such a software a few years ago, so I got it out of the attic and added the filtering part. You can find the result at Github.

It’s the usual feed to mail software: You write the configuration of your mail account in a file (.config/imap-feeder/config.ini), the feeds you’re interested in another (.config/imap-feeder/feeds.yaml), run it every so often, and watch item appear somewhere in your IMAP account.

In your configuration file you may specify a list of filters. Going back to the steam example, I’d write

feeds:
  - name: "Steam Game Sales"
    url: http://feeds.feedburner.com/SteamGameSalesUS
    filters: [steam_cheap]

And then I would add a function named “steam_cheap” to a file called filter.py in the configuration folder (usually ~/.config/imap-feeder). Each new item will be fed to the function and the result will appear on the mail folder. If the function returns None the item is discarded. It more than one filter is specified, then the output of each one will be fed to the following one.

For example, the filter for the Steam offers could be something like the following:

import re

def steam_cheap(feed,item):
    """Example filter for the Steam special sales
(http://feeds.feedburner.com/SteamGameSalesUS)
Return the feed only if the discounted price is under $10.00"""
    text = item['title_detail']['value']
    price = float( re.search("\$(\d+.\d+)",text).group(1))
    if price < 10.00:
        return item

The feed is passed to a function as parsed by feedparser.

The code needs some rework and has a few warts, but I plan to add the proper fixes over time.

The repo at github should contain enough information to get started using it.

Sometimes an image is worth more than a thousand words. This is true also for a text editor like Emacs, and in fact, while it’s graphical capabilities are limited, it is pretty easy to insert images in a buffer, and display them. While such capability is used in several modes (org-mode for example, or auctex), I never saw it used in Slime, so I’ll show how can be done with a simple example.