#!/usr/bin/env python

__license__ = 'GPL v3'
__copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
'''
lesoir.be
'''

from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe


class LeSoirBe(BasicNewsRecipe):
    title = u'Le Soir'
    __author__ = u'Lionel Bergeret'
    description = u'News from Belgium in French'
    publisher = u'lesoir.be'
    category = 'news, Belgium'
    oldest_article = 3
    language = 'fr'
    masthead_url = 'http://pdf.lesoir.be/pdf/images/SOIR//logo.gif'

    max_articles_per_feed = 20
    no_stylesheets = True
    use_embedded_content = False
    timefmt = ' [%d %b %Y]'

    keep_only_tags = [
        dict(name='div', attrs={'id': 'story_head'}), dict(
            name='div', attrs={'id': 'story_body'})
    ]

    remove_tags = [
        dict(name='form', attrs={'id': 'story_actions'}), dict(name='div', attrs={
            'id': 'sb-share'}), dict(name='div', attrs={'id': 'sb-subscribe'})
    ]

    feeds = [

    (u'Belgique', u'http://www.lesoir.be/actualite/belgique/rss.xml'),
    (u'France', u'http://www.lesoir.be/actualite/france/rss.xml'),
    (u'Monde', u'http://www.lesoir.be/actualite/monde/rss.xml'),
    (u'Regions', u'http://www.lesoir.be/regions/rss.xml'),
    (u'Vie du Net', u'http://www.lesoir.be/actualite/vie_du_net/rss.xml'),
    (u'Petite Gazette', u'http://www.lesoir.be/actualite/sciences/rss.xml')
    ]

    def get_cover_url(self):
        cover_url = strftime(
            'http://pdf.lesoir.be/pdf/%Y-%m-%d_BRUX_UNE_1.PDF')
        return cover_url
