spkdev / diaspora-rss-bot

A little RSS/Atom feed aggregator for Diaspora*
8 stars 2 forks source link

Make feedpost format configurable #5

Open spkdev opened 12 years ago

spkdev commented 12 years ago

Currently the feedposts have a really simple format: The <title> item is used as the posts' title as a clickable link and the <description> item as the posts' body. Most feeds work quite fine with this very basic format, but some feeds, like Cyanide & Happiness or 9gag do not link the images in the description, but in other fields. Since most of the fields are optional it is not really possible to find a generic solution for all possible feeds. There I want to make the post format configurable no a per feed basis, that is that you can define which feed entities are posted and how, I still have to figure out the details about this.

TLINDEN commented 12 years ago

You could use a template.

For example (config):

[feeds] fefe = http://blog.fefe.de/rss.xml?html

[format] fefe = basic

[templates] basic =< EOF [ <% title %>](% link %) <% tags %>

<% description %> EOF

Or something like this. If not configured a builtin template will be used. I don't know if Config::Tiny supports multiline entries. If it doesn't you might consider changing the config module as well. Or the templates are files and the config only refers to template filenames. And it might be a good idea to use template engine for this from the beginning which provides most flexibility (for the users). As a start I'd consider https://metacpan.org/module/Template::Tiny which makes it possible to switch to the larger https://metacpan.org/module/Template if neccessary.