Hi.

On Tue, Apr 12, 2016 at 10:49:45AM +0200, treaki wrote:
> Hi,
> 
> i like r2e very much, but there is one feature i would like to have also to 
> be included.
> If you have a look into the header of the mail you can see a lot of metadata 
> like X-RSS-TAGS, X-RSS-Feed and X-RSS-ID. 
> But what is missing is the rss date. normaly it is very similar to the mail 
> date if you run r2e regulary but sometimes, for
> example if you just have added a new feed, it isnt. So could you build in a 
> tag like X-RSS-pubDate so that this information isnt lost at the mail 
> transoframtion?
> 

May I suggest to report this feature request to the upstream : 
https://github.com/wking/rss2email/issues ? I doubt the Debian maintainer could 
do that change only for Debian.

In the meantime, you could try to add a post-processing python script that 
would add the needed elements.

Have a look at post_process/prettify.py for instance which will lead you on the 
right path.

For a similar need, I did the following : 

 - I added a Python script in 
~/bin/rss2email-postprocessing/python-modules/myrss2emailpostprocessing/__init__.py
   which defines a module named myrss2emailpostprocessing, which I use in 
rss2email.cfg with :
   post-process = myrss2emailpostprocessing process
 - The script is a copy of prettify.py where the pretty function goes that way :

def pretty(feed, parsed, entry, guid, message):
    """Use BeautifulSoup to pretty-print the html

    A very simple function that decodes the entry into a unicode
    string and then calls BeautifulSoup on it and afterwards encodes
    the feed entry
    """
    encoding = message.get_charsets()[0]
    content = str(message.get_payload(decode=True), encoding)

    content = content + '\n' + 'Date: ' + entry.updated
    
    message.set_payload(content, charset=encoding)
    return message

It's hackish, but works.
Of course, here, I'm adding the 'updated' date of the atom feed in the test, 
and you'll need to adapt to something more in line with headers.

Hope this helps,

Best regards.
-- 
Olivier BERGER 
http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

Reply via email to