#!/usr/bin/env python

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

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


class LaMeuse(BasicNewsRecipe):
    title = u'La Meuse'
    __author__ = u'Lionel Bergeret'
    description = u'News from Belgium in French'
    publisher = u'lameuse.be'
    category = 'news, Belgium'
    oldest_article = 3
    language = 'fr'
    masthead_url = 'http://www.lameuse.be/images/SPV3/logo_header_LM.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': 'article'})
    ]

    remove_tags = [
        dict(name='div', attrs={'class': 'sb-group'}), dict(name='div', attrs={'id': 'share'}), dict(name='div', attrs={'id': 'commentaires'}), dict(name='ul', attrs={'class': 'right liensutiles'}), dict(name='ul', attrs={'class': 'bas liensutiles'}), dict(name='p', attrs={'class': 'ariane'}), dict(name='div', attrs={'class': 'inner-bloc'}), dict(name='div', attrs={'class': 'block-01'})  # noqa
    ]

    feeds = [

    (u'Actualite', u'http://www.lameuse.be/services/fils_rss/actualite/index.xml'),
    (u'Belgique', u'http://www.lameuse.be/services/fils_rss/actualite/belgique/index.xml'),
    (u'Monde', u'http://www.lameuse.be/services/fils_rss/actualite/monde/index.xml'),
    (u'Societe', u'http://www.lameuse.be/services/fils_rss/actualite/societe/index.xml'),
    (u'Faits Divers', u'http://www.lameuse.be/services/fils_rss/actualite/faits_divers/index.xml'),
    (u'Economie', u'http://www.lameuse.be/services/fils_rss/actualite/economie/index.xml'),
    (u'Science', u'http://www.lameuse.be/services/fils_rss/actualite/science/index.xml'),
    (u'Sante', u'http://www.lameuse.be/services/fils_rss/actualite/sante/index.xml'),
    (u'Insolite', u'http://www.lameuse.be/services/fils_rss/magazine/insolite/index.xml'),
    (u'Cinema', u'http://www.lameuse.be/services/fils_rss/culture/cinema/index.xml'),
    (u'Musique', u'http://www.lameuse.be/services/fils_rss/culture/musique/index.xml'),
    (u'Livres', u'http://www.lameuse.be/services/fils_rss/culture/livres/index.xml')
    ]

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